Action.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /** PURE_IMPORTS_START .._Subscription 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 { Subscription } from '../Subscription';
  10. /**
  11. * A unit of work to be executed in a {@link Scheduler}. An action is typically
  12. * created from within a Scheduler and an RxJS user does not need to concern
  13. * themselves about creating and manipulating an Action.
  14. *
  15. * ```ts
  16. * class Action<T> extends Subscription {
  17. * new (scheduler: Scheduler, work: (state?: T) => void);
  18. * schedule(state?: T, delay: number = 0): Subscription;
  19. * }
  20. * ```
  21. *
  22. * @class Action<T>
  23. */
  24. export var Action = /*@__PURE__*/ (/*@__PURE__*/ function (_super) {
  25. __extends(Action, _super);
  26. function Action(scheduler, work) {
  27. _super.call(this);
  28. }
  29. /**
  30. * Schedules this action on its parent Scheduler for execution. May be passed
  31. * some context object, `state`. May happen at some point in the future,
  32. * according to the `delay` parameter, if specified.
  33. * @param {T} [state] Some contextual data that the `work` function uses when
  34. * called by the Scheduler.
  35. * @param {number} [delay] Time to wait before executing the work, where the
  36. * time unit is implicit and defined by the Scheduler.
  37. * @return {void}
  38. */
  39. Action.prototype.schedule = function (state, delay) {
  40. if (delay === void 0) {
  41. delay = 0;
  42. }
  43. return this;
  44. };
  45. return Action;
  46. }(Subscription));
  47. //# sourceMappingURL=Action.js.map