5.1.0 • Published 1 month ago

oop-timers v5.1.0

Weekly downloads
22
License
MIT
Repository
github
Last release
1 month ago

oop-timers

This library wraps JavaScript timers (timeout and interval) in a class to provide OOP way of using them.

  • 🌟 Extra features - stop repeating yourself
  • 🛠 First class TypeScript support - 100% type safe and intellisense friendly
  • 📦 No dependencies - it's small and can be used anywhere
  • 🌎 Universal - exposes both ESM modules and CommonJS
  • 🛡️ Safe - fully tested and used in production

Quick example

import { Timeout } from 'oop-timers';

const timeout = new Timeout(() => console.log('Hello world!'), 1000);
timeout.start();

// Imagine UI with start and stop buttons and input for new timeout value :)

stopButton.addEventListener('click', () => timeout.stop());
startButton.addEventListener('click', () => timeout.start(Number(newTimeoutInput.value)));

Docs

Documentation can be found here: oop-timers documentation.

To do

  • Support for requestAnimationFrame?

License

MIT

5.1.0

1 month ago

5.0.0

1 year ago

4.0.2

1 year ago

4.0.1

3 years ago

4.0.0

3 years ago

4.0.0-next.1

4 years ago

3.0.1

4 years ago

3.0.0

4 years ago

2.0.1

5 years ago

2.0.0

5 years ago

1.0.0

6 years ago