cronut
Tasty task scheduler with a mungable internal clock filling.
Install
$ npm install --save cronut
Usage
Schedule Tasks
; const cron = ; ; ; ; ;
Unschedule Tasks
const removeTask = ; // Unschedule after 10 seconds;
API
cronut()
Creates a new task scheduler.
; const cron = ;
cron(pattern, task[, options]) : Function
cron.addTask(pattern, task[, options]) : Function
pattern
String
task
Function
options
Object
resolution
Number
Default:100
.
Patterns are any valid pattern supported by cron
. The task is the function to be executed at the appointed times. Returns a function to stop the task.
; // same as cron; // removable const removeTask = cron; ;
cron.now(fn)
fn
Function
Sets the moment.now
function and resets internal cron timers.
cron;
Why?
There are a bunch of task schedulers already available, but none of them allowed me to mess with the internal clock for timeline manipulation or testing purposes.
Contribute
Standards for this project, including tests, code coverage, and semantics are enforced with a build tool. Pull requests must include passing tests with 100% code coverage and no linting errors.
Test
$ npm test
© Shannon Moeller me@shannonmoeller.com (http://shannonmoeller.com)
Licensed under MIT