source: trip-planner-front/node_modules/rxjs/src/internal/util/subscribeToPromise.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: 440 bytes
Line 
1import { Subscriber } from '../Subscriber';
2import { hostReportError } from './hostReportError';
3
4export const subscribeToPromise = <T>(promise: PromiseLike<T>) => (subscriber: Subscriber<T>) => {
5 promise.then(
6 (value) => {
7 if (!subscriber.closed) {
8 subscriber.next(value);
9 subscriber.complete();
10 }
11 },
12 (err: any) => subscriber.error(err)
13 )
14 .then(null, hostReportError);
15 return subscriber;
16};
Note: See TracBrowser for help on using the repository browser.