observableCoroutine.d.ts 949 B

1234567891011121314151617181920212223
  1. import type { AsyncCoroutine, CoroutineScheduler } from "./coroutine";
  2. declare module "./observable" {
  3. interface Observable<T> {
  4. /**
  5. * Internal observable-based coroutine scheduler instance.
  6. */
  7. _coroutineScheduler?: CoroutineScheduler<void>;
  8. /**
  9. * Internal disposal method for observable-based coroutine scheduler instance.
  10. */
  11. _coroutineSchedulerDispose?: () => void;
  12. /**
  13. * Runs a coroutine asynchronously on this observable
  14. * @param coroutine the iterator resulting from having started the coroutine
  15. * @returns a promise which will be resolved when the coroutine finishes or rejected if the coroutine is cancelled
  16. */
  17. runCoroutineAsync(coroutine: AsyncCoroutine<void>): Promise<void>;
  18. /**
  19. * Cancels all coroutines currently running on this observable
  20. */
  21. cancelAllCoroutines(): void;
  22. }
  23. }