promisified-timer
v0.1.3
Published
Promise version of setTimeout and clearTimeout
Downloads
3
Readme
timer-promise
This is an adaptation of Wongoo Lee's timer-promise library. Thanks, Wongoo!
Stuff I added ontop of the original:
- UMD modules for frontend use.
- Typescript definitions.
- Use ES6 Promises (or a polyfil) instead of bringing it in via node require().
Promise version of setTimeout and clearTimeout
You can start and stop timer like this.
var timer = require('timer-promise');
Timer.start('foo', 5000).
then(function() {
}, function(cancelled) {
});
...
Timer.stop('foo');
instead of
var timeoutId = setTimeout(function() {
}, 5000);
...
clearTimeout(timeoutId);