AsapScheduler.js 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. import { __extends } from "tslib";
  2. import { AsyncScheduler } from './AsyncScheduler';
  3. var AsapScheduler = (function (_super) {
  4. __extends(AsapScheduler, _super);
  5. function AsapScheduler() {
  6. return _super !== null && _super.apply(this, arguments) || this;
  7. }
  8. AsapScheduler.prototype.flush = function (action) {
  9. this._active = true;
  10. var flushId = this._scheduled;
  11. this._scheduled = undefined;
  12. var actions = this.actions;
  13. var error;
  14. action = action || actions.shift();
  15. do {
  16. if ((error = action.execute(action.state, action.delay))) {
  17. break;
  18. }
  19. } while ((action = actions[0]) && action.id === flushId && actions.shift());
  20. this._active = false;
  21. if (error) {
  22. while ((action = actions[0]) && action.id === flushId && actions.shift()) {
  23. action.unsubscribe();
  24. }
  25. throw error;
  26. }
  27. };
  28. return AsapScheduler;
  29. }(AsyncScheduler));
  30. export { AsapScheduler };
  31. //# sourceMappingURL=AsapScheduler.js.map