pnpm
Version:
Fast, disk space efficient package manager
25 lines (20 loc) • 602 B
JavaScript
/** @license MIT License (c) copyright 2010-2016 original author or authors */
/** @author Brian Cavalier */
/** @author John Hann */
export default function ScheduledTask (delay, period, task, scheduler) {
this.time = delay
this.period = period
this.task = task
this.scheduler = scheduler
this.active = true
}
ScheduledTask.prototype.run = function () {
return this.task.run(this.time)
}
ScheduledTask.prototype.error = function (e) {
return this.task.error(this.time, e)
}
ScheduledTask.prototype.dispose = function () {
this.scheduler.cancel(this)
return this.task.dispose()
}