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:
585 bytes
|
Line | |
---|
1 | import { Observable } from '../Observable';
|
---|
2 | import { SchedulerLike } from '../types';
|
---|
3 | import { Subscription } from '../Subscription';
|
---|
4 |
|
---|
5 | export 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.