| 1 |
import { Observable } from '../Observable'; |
| 2 |
import { EMPTY } from './empty'; |
| 3 |
export function range(start, count, scheduler) { |
| 4 |
if (count == null) { |
| 5 |
count = start; |
| 6 |
start = 0; |
| 7 |
} |
| 8 |
if (count <= 0) { |
| 9 |
return EMPTY; |
| 10 |
} |
| 11 |
const end = count + start; |
| 12 |
return new Observable(scheduler |
| 13 |
? |
| 14 |
(subscriber) => { |
| 15 |
let n = start; |
| 16 |
return scheduler.schedule(function () { |
| 17 |
if (n < end) { |
| 18 |
subscriber.next(n++); |
| 19 |
this.schedule(); |
| 20 |
} |
| 21 |
else { |
| 22 |
subscriber.complete(); |
| 23 |
} |
| 24 |
}); |
| 25 |
} |
| 26 |
: |
| 27 |
(subscriber) => { |
| 28 |
let n = start; |
| 29 |
while (n < end && !subscriber.closed) { |
| 30 |
subscriber.next(n++); |
| 31 |
} |
| 32 |
subscriber.complete(); |
| 33 |
}); |
| 34 |
} |
| 35 |
//# sourceMappingURL=range.js.map |