Action.d.ts 1.2 KB

123456789101112131415161718192021222324252627282930
  1. import { Scheduler } from '../Scheduler';
  2. import { Subscription } from '../Subscription';
  3. /**
  4. * A unit of work to be executed in a {@link Scheduler}. An action is typically
  5. * created from within a Scheduler and an RxJS user does not need to concern
  6. * themselves about creating and manipulating an Action.
  7. *
  8. * ```ts
  9. * class Action<T> extends Subscription {
  10. * new (scheduler: Scheduler, work: (state?: T) => void);
  11. * schedule(state?: T, delay: number = 0): Subscription;
  12. * }
  13. * ```
  14. *
  15. * @class Action<T>
  16. */
  17. export declare class Action<T> extends Subscription {
  18. constructor(scheduler: Scheduler, work: (this: Action<T>, state?: T) => void);
  19. /**
  20. * Schedules this action on its parent Scheduler for execution. May be passed
  21. * some context object, `state`. May happen at some point in the future,
  22. * according to the `delay` parameter, if specified.
  23. * @param {T} [state] Some contextual data that the `work` function uses when
  24. * called by the Scheduler.
  25. * @param {number} [delay] Time to wait before executing the work, where the
  26. * time unit is implicit and defined by the Scheduler.
  27. * @return {void}
  28. */
  29. schedule(state?: T, delay?: number): Subscription;
  30. }