| 1 |
import { __extends } from "tslib"; |
| 2 |
import { AsyncAction } from './AsyncAction'; |
| 3 |
var QueueAction = (function (_super) { |
| 4 |
__extends(QueueAction, _super); |
| 5 |
function QueueAction(scheduler, work) { |
| 6 |
var _this = _super.call(this, scheduler, work) || this; |
| 7 |
_this.scheduler = scheduler; |
| 8 |
_this.work = work; |
| 9 |
return _this; |
| 10 |
} |
| 11 |
QueueAction.prototype.schedule = function (state, delay) { |
| 12 |
if (delay === void 0) { delay = 0; } |
| 13 |
if (delay > 0) { |
| 14 |
return _super.prototype.schedule.call(this, state, delay); |
| 15 |
} |
| 16 |
this.delay = delay; |
| 17 |
this.state = state; |
| 18 |
this.scheduler.flush(this); |
| 19 |
return this; |
| 20 |
}; |
| 21 |
QueueAction.prototype.execute = function (state, delay) { |
| 22 |
return delay > 0 || this.closed ? _super.prototype.execute.call(this, state, delay) : this._execute(state, delay); |
| 23 |
}; |
| 24 |
QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) { |
| 25 |
if (delay === void 0) { delay = 0; } |
| 26 |
if ((delay != null && delay > 0) || (delay == null && this.delay > 0)) { |
| 27 |
return _super.prototype.requestAsyncId.call(this, scheduler, id, delay); |
| 28 |
} |
| 29 |
scheduler.flush(this); |
| 30 |
return 0; |
| 31 |
}; |
| 32 |
return QueueAction; |
| 33 |
}(AsyncAction)); |
| 34 |
export { QueueAction }; |
| 35 |
//# sourceMappingURL=QueueAction.js.map |