30 lines
710 B
JavaScript
30 lines
710 B
JavaScript
"use strict";
|
|
|
|
Object.defineProperty(exports, "__esModule", {
|
|
value: true
|
|
});
|
|
exports.default = ScheduledTask;
|
|
/** @license MIT License (c) copyright 2010-2016 original author or authors */
|
|
/** @author Brian Cavalier */
|
|
/** @author John Hann */
|
|
|
|
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();
|
|
}; |