Last change
on this file since e29cc2e was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Line | |
---|
1 | "use strict";
|
---|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
3 | var Observable_1 = require("../Observable");
|
---|
4 | function range(start, count, scheduler) {
|
---|
5 | if (start === void 0) { start = 0; }
|
---|
6 | return new Observable_1.Observable(function (subscriber) {
|
---|
7 | if (count === undefined) {
|
---|
8 | count = start;
|
---|
9 | start = 0;
|
---|
10 | }
|
---|
11 | var index = 0;
|
---|
12 | var current = start;
|
---|
13 | if (scheduler) {
|
---|
14 | return scheduler.schedule(dispatch, 0, {
|
---|
15 | index: index, count: count, start: start, subscriber: subscriber
|
---|
16 | });
|
---|
17 | }
|
---|
18 | else {
|
---|
19 | do {
|
---|
20 | if (index++ >= count) {
|
---|
21 | subscriber.complete();
|
---|
22 | break;
|
---|
23 | }
|
---|
24 | subscriber.next(current++);
|
---|
25 | if (subscriber.closed) {
|
---|
26 | break;
|
---|
27 | }
|
---|
28 | } while (true);
|
---|
29 | }
|
---|
30 | return undefined;
|
---|
31 | });
|
---|
32 | }
|
---|
33 | exports.range = range;
|
---|
34 | 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 | exports.dispatch = dispatch;
|
---|
49 | //# sourceMappingURL=range.js.map |
---|
Note:
See
TracBrowser
for help on using the repository browser.