@jayarjo/scheduler
v1.1.3
Published
Schedule a task to execute after some period, regularly with a given interval, just given amount of times, or simply until it succeeds.
Downloads
15
Readme
scheduler
import { scheduler } from '@jayarjo/scheduler'
// run once in certain amount of time units (milliseconds by default)
scheduler.runIn(fn, 5000) // invoke fn in 5 secs
// run consequently with the specified interval
const taskId = scheduler.runEvery(fn, 1000) // invoke every second
// task can be removed if required after certain amount of time
setTimeout(() => {
scheduler.removeTask(taskId)
}, 5000)