UNPKG

micro-message

Version:

global data store of micro front-end / multi app

26 lines (25 loc) 1.15 kB
export type StoreValueChangeCallback = (newValue: any, oldValue: any) => any; export declare const SubBaseForValueChange: { get: (key: string) => StoreValueChangeCallback[]; add: (key: string, callback: StoreValueChangeCallback) => void; addToAll: (callback: StoreValueChangeCallback) => void; destory: (key: string) => void; delete: (key: string, callback: StoreValueChangeCallback) => boolean; dispatch: (key: string, ...args: any[]) => void; dispatchAll: (...args: any[]) => void; }; export type IStoreDispatchValueSubParams = { key: string; newValue: any; oldValue: any; newStoreValue: any; }; export declare const dispatchValueSubscribes: ({ key, newValue, oldValue, newStoreValue, }: IStoreDispatchValueSubParams) => void; declare function onValueChange(callback: StoreValueChangeCallback): any; declare function onValueChange(key: string, callback: StoreValueChangeCallback): any; export declare const StoreChange: { $on: typeof onValueChange; $destory: (key: string) => void; $delete: (key: string, callback: StoreValueChangeCallback) => boolean; }; export {};