GithubHelp home page GithubHelp logo

aholstenson / timer-wheel Goto Github PK

View Code? Open in Web Editor NEW
8.0 8.0 1.0 451 KB

JavaScript/TypeScript library for efficiently managing a large amount of timed actions

License: MIT License

JavaScript 2.41% TypeScript 97.59%
expiration javascript timer timer-wheel typescript

timer-wheel's Introduction

👋 Hi, I'm Andreas Holstenson

I work with user-centered problem solving using technology. You'll find me in Malmö, Sweden.

I enjoy building things and over the years on GitHub I've pushed 6375 commits, opened 45 issues and submitted 38 PRs. There's currently 25 repositories around here with 2022 stars.

Want to get in touch? Send me an e-mail at [email protected] or connect with me on LinkedIn.

timer-wheel's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

neyio

timer-wheel's Issues

🙋‍♂️question

When the time interval for pushing the wheel is less than 500ms, the task scheduled between two pushes cannot be accurately obtained. Is this a problem of terminal performance? Is it avoidable?

const wheel = new TimerWheel<any>();
wheel.schedule('400', 400 /* ms */);
wheel.schedule('500', 500 /* ms */);
wheel.schedule('600', 600 /* ms */);
wheel.schedule('700', 700 /* ms */);
wheel.schedule('800', 800 /* ms */);
wheel.schedule('900', 900 /* ms */);
let i = 1;
setInterval(() => {
  console.info(i * 300, wheel);
  i++;
  const expired = wheel.advance();
  for (const data of expired) {
    console.info(data);
  }
}, 300);
300;
600;
900;
1200;
data: 400;
data: 500;
data: 600;
data: 700;
data: 800;
data: 900;
data: 1000;
data: 1100;
data: 1200;
1500;
1800;
2100;
data: 1300;
2400;
2700;

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.