Socket
Socket
Sign inDemoInstall

oop-timers

Package Overview
Dependencies
0
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    oop-timers

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


Version published
Weekly downloads
33
decreased by-59.76%
Maintainers
1
Install size
483 kB
Created
Weekly downloads
 

Readme

Source

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

FAQs

Last updated on 31 Mar 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc