@ovine/core
Version:
Build flexible admin system with json.
17 lines (16 loc) • 597 B
TypeScript
/**
* 实现消息通知逻辑
* 解耦组件状态依赖
*/
declare type Key = string | string[];
export declare type Handler<T = any> = (data: T, key: string) => void;
export declare const observeStore: any;
export declare function publish<T>(key: Key, value?: T): void;
export declare function unsubscribe(key: Key, handler?: Handler): void;
export declare function unsubscribeAll(): void;
export declare function subscribe(key: Key, handler: Handler): {
key: Key;
unsubscribe: () => void;
};
export declare function subscribeOnce<T>(key: string, handler: Handler): void;
export {};