Last change
on this file since 8d391a1 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.3 KB
|
Line | |
---|
1 | /** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */
|
---|
2 | import { Observable } from '../Observable';
|
---|
3 | export function range(start, count, scheduler) {
|
---|
4 | if (start === void 0) {
|
---|
5 | start = 0;
|
---|
6 | }
|
---|
7 | return new Observable(function (subscriber) {
|
---|
8 | if (count === undefined) {
|
---|
9 | count = start;
|
---|
10 | start = 0;
|
---|
11 | }
|
---|
12 | var index = 0;
|
---|
13 | var current = start;
|
---|
14 | if (scheduler) {
|
---|
15 | return scheduler.schedule(dispatch, 0, {
|
---|
16 | index: index, count: count, start: start, subscriber: subscriber
|
---|
17 | });
|
---|
18 | }
|
---|
19 | else {
|
---|
20 | do {
|
---|
21 | if (index++ >= count) {
|
---|
22 | subscriber.complete();
|
---|
23 | break;
|
---|
24 | }
|
---|
25 | subscriber.next(current++);
|
---|
26 | if (subscriber.closed) {
|
---|
27 | break;
|
---|
28 | }
|
---|
29 | } while (true);
|
---|
30 | }
|
---|
31 | return undefined;
|
---|
32 | });
|
---|
33 | }
|
---|
34 | export function dispatch(state) {
|
---|
35 | var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber;
|
---|
36 | if (index >= count) {
|
---|
37 | subscriber.complete();
|
---|
38 | return;
|
---|
39 | }
|
---|
40 | subscriber.next(start);
|
---|
41 | if (subscriber.closed) {
|
---|
42 | return;
|
---|
43 | }
|
---|
44 | state.index = index + 1;
|
---|
45 | state.start = start + 1;
|
---|
46 | this.schedule(state);
|
---|
47 | }
|
---|
48 | //# sourceMappingURL=range.js.map
|
---|
Note:
See
TracBrowser
for help on using the repository browser.