scheduleAsyncIterable.js 1.0 KB

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.scheduleAsyncIterable = void 0;
  4. var Observable_1 = require("../Observable");
  5. var executeSchedule_1 = require("../util/executeSchedule");
  6. function scheduleAsyncIterable(input, scheduler) {
  7. if (!input) {
  8. throw new Error('Iterable cannot be null');
  9. }
  10. return new Observable_1.Observable(function (subscriber) {
  11. executeSchedule_1.executeSchedule(subscriber, scheduler, function () {
  12. var iterator = input[Symbol.asyncIterator]();
  13. executeSchedule_1.executeSchedule(subscriber, scheduler, function () {
  14. iterator.next().then(function (result) {
  15. if (result.done) {
  16. subscriber.complete();
  17. }
  18. else {
  19. subscriber.next(result.value);
  20. }
  21. });
  22. }, 0, true);
  23. });
  24. });
  25. }
  26. exports.scheduleAsyncIterable = scheduleAsyncIterable;
  27. //# sourceMappingURL=scheduleAsyncIterable.js.map