Action.js 1.6 KB

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