UNPKG

@reactivex/ix-es5-esm

Version:

The Interactive Extensions for JavaScript

36 lines (34 loc) 1.16 kB
var ActionSubscription = /** @class */ (function () { function ActionSubscription(action) { this.isUnsubscribed = false; this._action = action; } ActionSubscription.prototype.unsubscribe = function () { if (!this.isUnsubscribed) { this.isUnsubscribed = true; this._action(); } }; return ActionSubscription; }()); var DefaultScheduler = /** @class */ (function () { function DefaultScheduler() { } Object.defineProperty(DefaultScheduler.prototype, "now", { get: function () { return Date.now(); }, enumerable: false, configurable: true }); DefaultScheduler.prototype.delay = function (dueTime) { return new Promise(function (res) { return setTimeout(res, dueTime); }); }; DefaultScheduler.prototype.schedule = function (action, dueTime) { var id = setTimeout(function () { return action(); }, dueTime); return new ActionSubscription(function () { return clearTimeout(id); }); }; return DefaultScheduler; }()); export { DefaultScheduler }; //# sourceMappingURL=scheduler.js.map