zenObservable.d.ts 1.2 KB

123456789101112131415161718192021
  1. import { ZenObservable } from './types';
  2. export { ZenObservable };
  3. export declare type Observer<T> = ZenObservable.Observer<T>;
  4. export declare type Subscriber<T> = ZenObservable.Subscriber<T>;
  5. export declare type ObservableLike<T> = ZenObservable.ObservableLike<T>;
  6. export declare const Observable: {
  7. new <T>(subscriber: Subscriber<T>): Observable<T>;
  8. from<R>(observable: Observable<R> | ZenObservable.ObservableLike<R> | ArrayLike<R>): Observable<R>;
  9. of<R>(...args: Array<R>): Observable<R>;
  10. };
  11. export interface Observable<T> {
  12. subscribe(observerOrNext: ((value: T) => void) | ZenObservable.Observer<T>, error?: (error: any) => void, complete?: () => void): ZenObservable.Subscription;
  13. forEach(fn: (value: T) => void): Promise<void>;
  14. map<R>(fn: (value: T) => R): Observable<R>;
  15. filter(fn: (value: T) => boolean): Observable<T>;
  16. reduce<R = T>(fn: (previousValue: R | T, currentValue: T) => R | T, initialValue?: R | T): Observable<R | T>;
  17. flatMap<R>(fn: (value: T) => ZenObservable.ObservableLike<R>): Observable<R>;
  18. from<R>(observable: Observable<R> | ZenObservable.ObservableLike<R> | ArrayLike<R>): Observable<R>;
  19. of<R>(...args: Array<R>): Observable<R>;
  20. }
  21. //# sourceMappingURL=zenObservable.d.ts.map