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
|
Rev | Line | |
---|
[6a3a178] | 1 | import { Subscriber } from '../Subscriber';
|
---|
| 2 | import { hostReportError } from './hostReportError';
|
---|
| 3 |
|
---|
| 4 | export 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.