source: trip-planner-front/node_modules/rxjs/src/internal/scheduled/scheduleObservable.ts

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: 852 bytes
Line 
1import { Observable } from '../Observable';
2import { Subscription } from '../Subscription';
3import { observable as Symbol_observable } from '../symbol/observable';
4import { InteropObservable, SchedulerLike, Subscribable } from '../types';
5
6export function scheduleObservable<T>(input: InteropObservable<T>, scheduler: SchedulerLike) {
7 return new Observable<T>(subscriber => {
8 const sub = new Subscription();
9 sub.add(scheduler.schedule(() => {
10 const observable: Subscribable<T> = input[Symbol_observable]();
11 sub.add(observable.subscribe({
12 next(value) { sub.add(scheduler.schedule(() => subscriber.next(value))); },
13 error(err) { sub.add(scheduler.schedule(() => subscriber.error(err))); },
14 complete() { sub.add(scheduler.schedule(() => subscriber.complete())); },
15 }));
16 }));
17 return sub;
18 });
19}
Note: See TracBrowser for help on using the repository browser.