0.3.1 • Published 2 years ago
@gallofeliz/scheduler v0.3.1
Scheduler
Note: This module is part of @gallofeliz/js-libs that is a personal project. It is not developed nor tested for applications that need high security or scalability.
This is not a tasker. To handle complex job management, see @gallofeliz/tasker
"when" uses @gallofeliz/dates-iterators
// Simple Schedule
schedule({
fn(infos) {
console.log('Do job')
},
when: {
times: ['PT2S'],
limit: 5
}
})
// Scheduler
const scheduler = new Scheduler({
onError(error, id) {
console.log('error on', id, error)
}
})
scheduler.schedule({
id: 'test1',
fn() {
console.log('Do job 1')
},
when: ['PT1S']
})
scheduler.start(abortSignal)