micro-message
Version:
global data store of micro front-end / multi app
18 lines (17 loc) • 1.19 kB
TypeScript
export type CommonFunc = (...args: any[]) => any;
export declare const getSubscribes: <T extends CommonFunc = CommonFunc>(key: string, scope: string) => T[];
export declare const addSubscribe: <T extends CommonFunc = CommonFunc>(key: string, callback: T, scope: string) => void;
export declare const addSubscribeToAll: <T extends CommonFunc = CommonFunc>(callback: T, scope: string) => void;
export declare const destorySubscribes: (key: string, scope: string) => void;
export declare const deleteSubscribe: <T extends CommonFunc = CommonFunc>(key: string, callback: T, scope: string) => boolean;
export declare const dispatchSubscribes: (key: string, scope: string, ...args: any[]) => void;
export declare const dispatchAllSubscribes: (scope: string, ...args: any[]) => void;
export declare const getSubscribeBase: <T extends CommonFunc = CommonFunc>(scope: string) => {
get: (key: string) => T[];
add: (key: string, callback: T) => void;
addToAll: (callback: T) => void;
destory: (key: string) => void;
delete: (key: string, callback: T) => boolean;
dispatch: (key: string, ...args: any[]) => void;
dispatchAll: (...args: any[]) => void;
};