@joker.front/core 1.2.144 → 1.2.145
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/types/event-bus.d.ts +9 -9
package/package.json
CHANGED
package/types/event-bus.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
export type EventCallBackItem = {
|
|
2
|
-
callBack: EventCallBackType
|
|
1
|
+
export type EventCallBackItem<T> = {
|
|
2
|
+
callBack: EventCallBackType<T>;
|
|
3
3
|
once?: Boolean;
|
|
4
4
|
};
|
|
5
|
-
export type EventCallBackType = (e: {
|
|
5
|
+
export type EventCallBackType<T> = (e: {
|
|
6
6
|
stopPropagation: Function;
|
|
7
7
|
callTimes: Number;
|
|
8
|
-
}, params?:
|
|
9
|
-
export declare class EventBus<T extends string
|
|
8
|
+
}, params?: T) => boolean | void;
|
|
9
|
+
export declare class EventBus<T extends Record<string, any>> {
|
|
10
10
|
private eventDatas;
|
|
11
|
-
on(eventName:
|
|
12
|
-
once(eventName:
|
|
13
|
-
off(eventName:
|
|
14
|
-
trigger(eventName:
|
|
11
|
+
on<K extends keyof T>(eventName: K, callBack: EventCallBackType<T[K]>): void;
|
|
12
|
+
once<K extends keyof T>(eventName: K, callBack: EventCallBackType<T[K]>): void;
|
|
13
|
+
off<K extends keyof T>(eventName: K, callBack?: EventCallBackType<T[K]>): void;
|
|
14
|
+
trigger<K extends keyof T>(eventName: K, param?: T[K]): false | undefined;
|
|
15
15
|
}
|