scheduleAsyncIterable.js 856 B

1234567891011121314151617181920212223
  1. import { Observable } from '../Observable';
  2. import { executeSchedule } from '../util/executeSchedule';
  3. export function scheduleAsyncIterable(input, scheduler) {
  4. if (!input) {
  5. throw new Error('Iterable cannot be null');
  6. }
  7. return new Observable(function (subscriber) {
  8. executeSchedule(subscriber, scheduler, function () {
  9. var iterator = input[Symbol.asyncIterator]();
  10. executeSchedule(subscriber, scheduler, function () {
  11. iterator.next().then(function (result) {
  12. if (result.done) {
  13. subscriber.complete();
  14. }
  15. else {
  16. subscriber.next(result.value);
  17. }
  18. });
  19. }, 0, true);
  20. });
  21. });
  22. }
  23. //# sourceMappingURL=scheduleAsyncIterable.js.map