feat(facade): add a way to convert observables into promises
This commit is contained in:
parent
fc50829481
commit
2c201d3f34
|
@ -61,6 +61,10 @@ class ObservableWrapper {
|
|||
static Stream fromPromise(Future f) {
|
||||
return new Stream.fromFuture(f);
|
||||
}
|
||||
|
||||
static Future toPromise(Stream s) {
|
||||
return s.single;
|
||||
}
|
||||
}
|
||||
|
||||
class EventEmitter<T> extends Stream<T> {
|
||||
|
|
|
@ -48,6 +48,8 @@ export class ObservableWrapper {
|
|||
static fromPromise(promise: Promise<any>): Observable<any> {
|
||||
return RxObservable.fromPromise(promise);
|
||||
}
|
||||
|
||||
static toPromise(obj: Observable<any>): Promise<any> { return (<any>obj).toPromise(); }
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue