Giter Site home page Giter Site logo

alwaystime's Introduction

alwaystime

关于定时器的封装 alwaysTime 方法为只执行一次 参数为 particle 多少秒后执行 callback回调函数

alwaysTimeMult为定时器方法 参数为particle 多少秒后执行 callback回调函数

removeAlwaysHook删除定时方法 将 定时任务 id 传入例: removeAlwaysHook(xxx)

两个方法将会返回当前任务销毁方法, 调用将销毁

demo

const clearTime = alwaysTimeMult(1, () => {
  console.log("第一个定时器");
});

alwaysTime(10, (item, key) => {
  console.log("第二个定时器, 将在10秒后被调用", item, key);
});
alwaysHookSize(); // 查看任务数量
clearTime(); // 将任务删除
alwaysHookSize(); // 查看任务数量

alwaystime's People

Contributors

lidaxuan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.