import { ObserverCbType, Subscription } from "./Subscription"; import { SubscriptionObserver } from "./SubscriptionObserver"; export declare type NoArgsWithoutReturnFunctionType = () => void; export declare type SubscriberCbType = (subscribeObserver: SubscriptionObserver) => NoArgsWithoutReturnFunctionType | void; export declare class Observable { private _subscriberCb; constructor(subscriberCb: SubscriberCbType); subscribe(observerCb: ((val?: T) => void) | ObserverCbType): Subscription; /** 创建一个 订阅,同时与 Promise 关联 */ forEach(nextResolveCb: (value?: T, cb?: () => void) => void): Promise; /** * filter: 建立两个订阅,中间加一层过滤,不满足过滤条件的第二个订阅不发布新消息 * map: 建立两个订阅,中间加一层处理,第一个订阅消息结果处理再通过第二个订阅发布 */ filter(predicate: (value?: T) => boolean): Observable; map(callbackfn: (value?: T) => T): Observable; /** * callbackFn 每次发布新消息时的回调 * seed 起始值 */ reduce(callbackFn: (acc?: T, value?: T) => T, initialValue?: T): Observable; static of(...items: K[]): Observable; static from(iteratorObj: Iterable): Observable; }