declare type Key = string | symbol; export declare type Callback = (newValue: any, oldValue: any) => void; declare type EventCallback = (...args: any[]) => void; declare type ThisArg = { [key: Key]: any; } | undefined; declare class Bus { [x: string]: any; private subscriberSet; private eventSet; constructor(); /** * 添加订阅 * @param thisArg 当前订阅对象 * @param globalDataPropertyName 订阅的属性 * @param callback 更改后回调 */ addSubscriber(thisArg: T, globalDataPropertyName: Key, callback: Callback): void; /** * 移除订阅者 * @param thisArg 当前对象 * @param globalDataPropertyName 全局属性名 */ removeSubscriber(thisArg: T, globalDataPropertyName: Key): void; /** * 添加事件监听 * @param thisArg 当前订阅对象 * @param eventName 订阅的属性 * @param callback 更改后回调 */ on(thisArg: T, eventName: Key, callback: EventCallback): void; /** * 派发事件 * @param eventName 事件名 * @param args 参数 */ emit(eventName: Key, ...args: any): void; /** * 移除事件 * @param eventName 事件名称 * @param thisArg 当前页面或者组件对象 */ remove(thisArg: T, eventName: Key): void; /** * 初始化隐藏方法及实现 */ private init; } declare const bus: Bus; export { bus };