AnimationFrameScheduler.js 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /** PURE_IMPORTS_START ._AsyncScheduler PURE_IMPORTS_END */
  2. var __extends = (this && this.__extends) || function (d, b) {
  3. for (var p in b)
  4. if (b.hasOwnProperty(p))
  5. d[p] = b[p];
  6. function __() { this.constructor = d; }
  7. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  8. };
  9. import { AsyncScheduler } from './AsyncScheduler';
  10. export var AnimationFrameScheduler = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  11. __extends(AnimationFrameScheduler, _super);
  12. function AnimationFrameScheduler() {
  13. _super.apply(this, arguments);
  14. }
  15. AnimationFrameScheduler.prototype.flush = function (action) {
  16. this.active = true;
  17. this.scheduled = undefined;
  18. var actions = this.actions;
  19. var error;
  20. var index = -1;
  21. var count = actions.length;
  22. action = action || actions.shift();
  23. do {
  24. if (error = action.execute(action.state, action.delay)) {
  25. break;
  26. }
  27. } while (++index < count && (action = actions.shift()));
  28. this.active = false;
  29. if (error) {
  30. while (++index < count && (action = actions.shift())) {
  31. action.unsubscribe();
  32. }
  33. throw error;
  34. }
  35. };
  36. return AnimationFrameScheduler;
  37. }(AsyncScheduler));
  38. //# sourceMappingURL=AnimationFrameScheduler.js.map