© 2016, Onur Yıldırım (@onury). MIT License.
A timer utility for running periodic tasks on the given interval ticks. This is useful when you want to run or schedule multiple tasks (on a single timer instance).
Universal module. Works in both Node and Browser. Less than 3KB (minified, gzipped).
npm i tasktimer --save
In Node/CommonJS environments:
var TaskTimer = ;
via script tag in the browser:
// Timer with 1000ms (1 second) base interval resolution.var timer = 1000// interval can be updated anytime by setting the `timer.interval` property.// Add task(s) based on tick intervals.timer;// Execute some code on each tick... (every 1 second)timer;// Start the timertimerstart;
See API documentation and examples here.