1234567891011121314151617181920212223242526 |
- import { Observable } from '../Observable';
- import { Subscription } from '../Subscription';
- import { subscribeToArray } from '../util/subscribeToArray';
- export function fromArray(input, scheduler) {
- if (!scheduler) {
- return new Observable(subscribeToArray(input));
- }
- else {
- return new Observable(subscriber => {
- const sub = new Subscription();
- let i = 0;
- sub.add(scheduler.schedule(function () {
- if (i === input.length) {
- subscriber.complete();
- return;
- }
- subscriber.next(input[i++]);
- if (!subscriber.closed) {
- sub.add(this.schedule());
- }
- }));
- return sub;
- });
- }
- }
- //# sourceMappingURL=fromArray.js.map
|