fastevent 2.2.11 → 2.3.0

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.
@@ -11,9 +11,7 @@ type TypedFastEventMessage<Events extends Record<string, any> = Record<string, a
11
11
  meta: FastEventMeta & M & Record<string, any>;
12
12
  };
13
13
  }[Exclude<keyof Events, number | symbol>] & FastEventMessageExtends;
14
- type TypedFastEventListener<T extends string = string, P = any, M = any, C = any> = (this: C, message: TypedFastEventMessage<{
15
- [K in T]: P;
16
- }, M>, args: FastEventListenerArgs<M>) => any | Promise<any>;
14
+ type TypedFastEventListener<T extends string = string, P = any, M = any, C = any> = (this: C, message: TypedFastEventMessage<Record<T, P>, M>, args: FastEventListenerArgs<M>) => any | Promise<any>;
17
15
  /**
18
16
  * [
19
17
  * 监听器函数引用,
@@ -24,6 +22,9 @@ type TypedFastEventListener<T extends string = string, P = any, M = any, C = any
24
22
  * ]
25
23
  */
26
24
  type FastListenerMeta = [TypedFastEventListener<any, any>, number, number, string, number];
25
+ declare enum FastEventListenerFlags {
26
+ Transformed = 1
27
+ }
27
28
  type FastEventListenerArgs<M = Record<string, any>> = {
28
29
  retain?: boolean;
29
30
  meta?: DeepPartial<M> & Record<string, any>;
@@ -40,6 +41,17 @@ type FastEventListenerArgs<M = Record<string, any>> = {
40
41
  * 当emit参数解析完成后的回调,用于修改emit参数
41
42
  */
42
43
  parseArgs?: (message: TypedFastEventMessage, args: FastEventListenerArgs) => void;
44
+ /**
45
+ * 额外的标识
46
+ *
47
+ * - 1: transformed 当消息是经过transform转换后的消息时的标识
48
+ *
49
+ */
50
+ flags?: FastEventListenerFlags;
51
+ /**
52
+ * 如果消息经过转换前的原主题
53
+ */
54
+ rawEventType?: string;
43
55
  };
44
56
  type DeepPartial<T> = {
45
57
  [P in keyof T]?: T[P] extends object ? DeepPartial<T[P]> : T[P];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastevent",
3
- "version": "2.2.11",
3
+ "version": "2.3.0",
4
4
  "description": "The Ultimate Event Trigger Library – Fast, Feature-Rich, Battle-Tested!",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",