source: trip-planner-front/node_modules/rxjs/_esm5/internal/scheduled/scheduleIterable.js

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 1.5 KB
RevLine 
[6a3a178]1/** PURE_IMPORTS_START _Observable,_Subscription,_symbol_iterator PURE_IMPORTS_END */
2import { Observable } from '../Observable';
3import { Subscription } from '../Subscription';
4import { iterator as Symbol_iterator } from '../symbol/iterator';
5export function scheduleIterable(input, scheduler) {
6 if (!input) {
7 throw new Error('Iterable cannot be null');
8 }
9 return new Observable(function (subscriber) {
10 var sub = new Subscription();
11 var iterator;
12 sub.add(function () {
13 if (iterator && typeof iterator.return === 'function') {
14 iterator.return();
15 }
16 });
17 sub.add(scheduler.schedule(function () {
18 iterator = input[Symbol_iterator]();
19 sub.add(scheduler.schedule(function () {
20 if (subscriber.closed) {
21 return;
22 }
23 var value;
24 var done;
25 try {
26 var result = iterator.next();
27 value = result.value;
28 done = result.done;
29 }
30 catch (err) {
31 subscriber.error(err);
32 return;
33 }
34 if (done) {
35 subscriber.complete();
36 }
37 else {
38 subscriber.next(value);
39 this.schedule();
40 }
41 }));
42 }));
43 return sub;
44 });
45}
46//# sourceMappingURL=scheduleIterable.js.map
Note: See TracBrowser for help on using the repository browser.