mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Turned Observer from class to interfaces.
This commit is contained in:
+13
-1
@@ -133,7 +133,7 @@ declare module Rx {
|
||||
|
||||
// Notifications
|
||||
export class Notification<T> {
|
||||
accept(observer: Observer<T>): void;
|
||||
accept(observer: IObserver<T>): void;
|
||||
accept<TResult>(onNext: (value: T) => TResult, onError?: (exception: any) => TResult, onCompleted?: () => TResult): TResult;
|
||||
toObservable(scheduler?: IScheduler): Observable<T>;
|
||||
hasValue: boolean;
|
||||
@@ -164,6 +164,18 @@ declare module Rx {
|
||||
onCompleted(): void;
|
||||
}
|
||||
|
||||
export interface Observer<T> extends IObserver<T> {
|
||||
toNotifier(): (notification: Notification<T>) => void;
|
||||
asObserver(): Observer<T>;
|
||||
}
|
||||
|
||||
interface ObserverStatic {
|
||||
create<T>(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observer<T>;
|
||||
fromNotifier<T>(handler: (notification: Notification<T>) => void): Observer<T>;
|
||||
}
|
||||
|
||||
export var Observer: ObserverStatic;
|
||||
|
||||
export interface IObservable<T> {
|
||||
subscribe(observer: Observer<T>): IDisposable;
|
||||
subscribe(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): IDisposable;
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// Type definitions for RxJS-Async v2.2.15
|
||||
// Type definitions for RxJS-Async v2.2.17
|
||||
// Project: http://rx.codeplex.com/
|
||||
// Definitions by: zoetrope <https://github.com/zoetrope>
|
||||
// Definitions by: Igor Oleinikov <https://github.com/Igorbek>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
// This file contains common part of defintions for rx.binding.d.ts and rx.lite.d.ts
|
||||
// Do not include the file separately.
|
||||
|
||||
///<reference path="rx-lite.ts"/>
|
||||
|
||||
declare module Rx {
|
||||
export interface BehaviorSubject<T> extends Subject<T> {
|
||||
}
|
||||
|
||||
Vendored
+4
-11
@@ -48,24 +48,17 @@ declare module Rx {
|
||||
}
|
||||
|
||||
// Observer
|
||||
export class Observer<T> implements IObserver<T> {
|
||||
onNext(value: T): void;
|
||||
onError(exception: any): void;
|
||||
onCompleted(): void;
|
||||
|
||||
toNotifier(): (notification: Notification<T>) =>void;
|
||||
asObserver(): Observer<T>;
|
||||
export interface Observer<T> {
|
||||
checked(): Observer<any>;
|
||||
}
|
||||
|
||||
static create<T>(onNext?: (value: T) => void, onError?: (exception: any) => void, onCompleted?: () => void): Observer<T>;
|
||||
static fromNotifier<T>(handler: (notification: Notification<T>) => void): Observer<T>;
|
||||
|
||||
interface ObserverStatic {
|
||||
/**
|
||||
* Schedules the invocation of observer methods on the given scheduler.
|
||||
* @param scheduler Scheduler to schedule observer messages on.
|
||||
* @returns Observer whose messages are scheduled on the given scheduler.
|
||||
*/
|
||||
static notifyOn<T>(scheduler: IScheduler): Observer<T>;
|
||||
notifyOn<T>(scheduler: IScheduler): Observer<T>;
|
||||
}
|
||||
|
||||
export interface Observable<T> {
|
||||
|
||||
Reference in New Issue
Block a user