Small wrappers for setTimeout and setInterval which return methods to cancel them.
npm install thyming
// same with require('thyming').timeout;
var interval = require('thyming').interval;
var stop = interval(function () {
// do something later!
});
/* ... */
// cancel the timer
stop();
Returns a method to cancel the timer.
Required
Type: function
The method to pass in to setTimeout, will be run after ms
milliseconds.
Type: number
The number of milliseconds to wait before executing fn
.
Returns a method to cancel the timer.
Required
Type: function
The method to pass in to setInterval, will be run every ms
milliseconds.
Type: number
The number of milliseconds to wait between executing fn
.
MIT