core-api: updated Observable type to support interop
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -53,6 +53,10 @@ export class PublishSubject<T>
|
||||
ZenObservable.SubscriptionObserver<T>
|
||||
>();
|
||||
|
||||
[Symbol.observable]() {
|
||||
return this;
|
||||
}
|
||||
|
||||
get closed() {
|
||||
return this.isClosed;
|
||||
}
|
||||
@@ -148,6 +152,10 @@ export class BehaviorSubject<T>
|
||||
ZenObservable.SubscriptionObserver<T>
|
||||
>();
|
||||
|
||||
[Symbol.observable]() {
|
||||
return this;
|
||||
}
|
||||
|
||||
get closed() {
|
||||
return this.isClosed;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ export type Subscription = {
|
||||
/**
|
||||
* Value indicating whether the subscription is closed.
|
||||
*/
|
||||
readonly closed: Boolean;
|
||||
readonly closed: boolean;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -51,12 +51,14 @@ export type Subscription = {
|
||||
* using many different observable implementations, such as zen-observable or RxJS 5.
|
||||
*/
|
||||
export type Observable<T> = {
|
||||
[Symbol.observable](): Observable<T>;
|
||||
|
||||
/**
|
||||
* Subscribes to this observable to start receiving new values.
|
||||
*/
|
||||
subscribe(observer: Observer<T>): Subscription;
|
||||
subscribe(
|
||||
onNext: (value: T) => void,
|
||||
onNext?: (value: T) => void,
|
||||
onError?: (error: Error) => void,
|
||||
onComplete?: () => void,
|
||||
): Subscription;
|
||||
|
||||
@@ -32,6 +32,10 @@ type Waiter = {
|
||||
|
||||
const nullObservable = {
|
||||
subscribe: () => ({ unsubscribe: () => {}, closed: true }),
|
||||
|
||||
[Symbol.observable]() {
|
||||
return this;
|
||||
},
|
||||
};
|
||||
|
||||
export class MockErrorApi implements ErrorApi {
|
||||
|
||||
Reference in New Issue
Block a user