source: trip-planner-front/node_modules/rxjs/src/internal/scheduled/schedulePromise.ts@ 8d391a1

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