timer-pool

0.0.2 • Public • Published

Timer Pool

Timer group management.

Install

$ npm i timer-pool

Usage

import {setTimer, clearTimer, setLoopTimer, clearLoopTimer} from 'timer-pool';

// set timeout in timeout group "foo"
setTimer('foo', () => {
    // do something;
    
});

// set another timeout in timeout group "foo"
setTimer('foo', () => {
    // do something else;
});

// set interval in interval group "foo"
setLoopTimer('foo', () => {
    // do something;
});

// set timeout in timeout group "bar" and get timeout identifier
const timerId = setTimer('bar', () => {
    // do something;
});

// clear timeout by group name
clearTimer('foo');

// clear timeout by identifier
clearTimer(timerId);

// clear interval by group name
clearLoopTimer('foo');

Readme

Keywords

none

Package Sidebar

Install

npm i timer-pool

Weekly Downloads

0

Version

0.0.2

License

MIT

Unpacked Size

4.33 kB

Total Files

4

Last publish

Collaborators

  • dafrok