mtimer-js
v1.0.2
Published
Managed Timers (interval & timemout) for Javascript
Downloads
2
Maintainers
Readme
MTimer JS
Managed Timers (interval & timemout) for Javascript
Override default setInterval
and setTimeout
functions
to allow better management.
Allows to list, stop, clear any launched timer.
Setup
- NPM
npm i mtimer-js
- Bower
bower install --save [email protected]:GotanDev/mtimer-js.git
Documentation
- Just use
setTimeout
&setInterval
,clearInterval
,clearTimeout
functions as usual window.timers
global variable includes now all active timers details.
Each items has the following structure:
{
id: Number,
type: 'interval'|'timeout',
functionName: String,
delay: Number,
startTime: Date
}
- Additionally on overrided basic functions , you can also get 2 additionnal functions:
clearTimer(timerId:number)
:
Clear a timer from its id
(either created by setInterval ou setTimeout functions)clearTimers(typeFilter: 'interval'|'timeout')
:
Reset all known active timers (timeouts and intervals) You can specify either timeout or interval
Default value: both