scheduled.js 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. import { scheduleObservable } from './scheduleObservable';
  2. import { schedulePromise } from './schedulePromise';
  3. import { scheduleArray } from './scheduleArray';
  4. import { scheduleIterable } from './scheduleIterable';
  5. import { scheduleAsyncIterable } from './scheduleAsyncIterable';
  6. import { isInteropObservable } from '../util/isInteropObservable';
  7. import { isPromise } from '../util/isPromise';
  8. import { isArrayLike } from '../util/isArrayLike';
  9. import { isIterable } from '../util/isIterable';
  10. import { isAsyncIterable } from '../util/isAsyncIterable';
  11. import { createInvalidObservableTypeError } from '../util/throwUnobservableError';
  12. import { isReadableStreamLike } from '../util/isReadableStreamLike';
  13. import { scheduleReadableStreamLike } from './scheduleReadableStreamLike';
  14. export function scheduled(input, scheduler) {
  15. if (input != null) {
  16. if (isInteropObservable(input)) {
  17. return scheduleObservable(input, scheduler);
  18. }
  19. if (isArrayLike(input)) {
  20. return scheduleArray(input, scheduler);
  21. }
  22. if (isPromise(input)) {
  23. return schedulePromise(input, scheduler);
  24. }
  25. if (isAsyncIterable(input)) {
  26. return scheduleAsyncIterable(input, scheduler);
  27. }
  28. if (isIterable(input)) {
  29. return scheduleIterable(input, scheduler);
  30. }
  31. if (isReadableStreamLike(input)) {
  32. return scheduleReadableStreamLike(input, scheduler);
  33. }
  34. }
  35. throw createInvalidObservableTypeError(input);
  36. }
  37. //# sourceMappingURL=scheduled.js.map