source: trip-planner-front/node_modules/rxjs/src/internal/scheduled/scheduleArray.ts@ fa375fe

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

initial commit

  • Property mode set to 100644
File size: 585 bytes
Line 
1import { Observable } from '../Observable';
2import { SchedulerLike } from '../types';
3import { Subscription } from '../Subscription';
4
5export function scheduleArray<T>(input: ArrayLike<T>, scheduler: SchedulerLike) {
6 return new Observable<T>(subscriber => {
7 const sub = new Subscription();
8 let i = 0;
9 sub.add(scheduler.schedule(function () {
10 if (i === input.length) {
11 subscriber.complete();
12 return;
13 }
14 subscriber.next(input[i++]);
15 if (!subscriber.closed) {
16 sub.add(this.schedule());
17 }
18 }));
19 return sub;
20 });
21}
Note: See TracBrowser for help on using the repository browser.