fastevent 1.1.2 → 1.1.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # fastevent
2
2
 
3
+ ## 1.1.3
4
+
5
+ ### Patch Changes
6
+
7
+ - 028475b: feat: 更改使用 interface FastEventMessage 以方便扩展
8
+
3
9
  ## 1.1.2
4
10
 
5
11
  ### Patch Changes
@@ -41,11 +41,11 @@ declare class WeakObjectMap<T extends object> {
41
41
  has(key: string): boolean;
42
42
  }
43
43
 
44
- type FastEventMessage<T = string, P = any, M = unknown> = {
44
+ interface FastEventMessage<T = string, P = any, M = unknown> {
45
45
  type: T;
46
46
  payload: P;
47
47
  meta: M;
48
- };
48
+ }
49
49
  type FastEventListener<T = string, P = any, M = unknown, C = any> = (this: C, message: FastEventMessage<T, P, M>) => any | Promise<any>;
50
50
  type FastListenerNode = {
51
51
  __listeners: (FastEventListener<any, any, any> | [FastEventListener<any, any>, number])[];
@@ -41,11 +41,11 @@ declare class WeakObjectMap<T extends object> {
41
41
  has(key: string): boolean;
42
42
  }
43
43
 
44
- type FastEventMessage<T = string, P = any, M = unknown> = {
44
+ interface FastEventMessage<T = string, P = any, M = unknown> {
45
45
  type: T;
46
46
  payload: P;
47
47
  meta: M;
48
- };
48
+ }
49
49
  type FastEventListener<T = string, P = any, M = unknown, C = any> = (this: C, message: FastEventMessage<T, P, M>) => any | Promise<any>;
50
50
  type FastListenerNode = {
51
51
  __listeners: (FastEventListener<any, any, any> | [FastEventListener<any, any>, number])[];
package/dist/index.d.mts CHANGED
@@ -1,8 +1,8 @@
1
- type FastEventMessage<T = string, P = any, M = unknown> = {
1
+ interface FastEventMessage<T = string, P = any, M = unknown> {
2
2
  type: T;
3
3
  payload: P;
4
4
  meta: M;
5
- };
5
+ }
6
6
  type FastEventListener<T = string, P = any, M = unknown, C = any> = (this: C, message: FastEventMessage<T, P, M>) => any | Promise<any>;
7
7
  type FastListenerNode = {
8
8
  __listeners: (FastEventListener<any, any, any> | [FastEventListener<any, any>, number])[];
@@ -12,9 +12,6 @@ type FastListenerNode = {
12
12
  type FastEventSubscriber = {
13
13
  off: () => void;
14
14
  };
15
- interface FastEventListenerMeta {
16
- emitter?: string;
17
- }
18
15
  type FastListeners = FastListenerNode;
19
16
  type FastEventOptions<M = Record<string, any>> = {
20
17
  id?: string;
@@ -467,4 +464,4 @@ declare class FastEvent<Events extends FastEvents = FastEvents, Meta extends Rec
467
464
  scope<T extends string>(prefix: T): FastEventScope<ScopeEvents<Events, T>, Record<string, any>, any, keyof ScopeEvents<Events, T>>;
468
465
  }
469
466
 
470
- export { FastEvent, type FastEventListenOptions, type FastEventListener, type FastEventListenerMeta, type FastEventMessage, type FastEventOptions, FastEventScope, type FastEventSubscriber, type FastEvents, type FastListenerNode, type FastListeners, type ScopeEvents };
467
+ export { FastEvent, type FastEventListenOptions, type FastEventListener, type FastEventMessage, type FastEventOptions, FastEventScope, type FastEventSubscriber, type FastEvents, type FastListenerNode, type FastListeners, type ScopeEvents };
package/dist/index.d.ts CHANGED
@@ -1,8 +1,8 @@
1
- type FastEventMessage<T = string, P = any, M = unknown> = {
1
+ interface FastEventMessage<T = string, P = any, M = unknown> {
2
2
  type: T;
3
3
  payload: P;
4
4
  meta: M;
5
- };
5
+ }
6
6
  type FastEventListener<T = string, P = any, M = unknown, C = any> = (this: C, message: FastEventMessage<T, P, M>) => any | Promise<any>;
7
7
  type FastListenerNode = {
8
8
  __listeners: (FastEventListener<any, any, any> | [FastEventListener<any, any>, number])[];
@@ -12,9 +12,6 @@ type FastListenerNode = {
12
12
  type FastEventSubscriber = {
13
13
  off: () => void;
14
14
  };
15
- interface FastEventListenerMeta {
16
- emitter?: string;
17
- }
18
15
  type FastListeners = FastListenerNode;
19
16
  type FastEventOptions<M = Record<string, any>> = {
20
17
  id?: string;
@@ -467,4 +464,4 @@ declare class FastEvent<Events extends FastEvents = FastEvents, Meta extends Rec
467
464
  scope<T extends string>(prefix: T): FastEventScope<ScopeEvents<Events, T>, Record<string, any>, any, keyof ScopeEvents<Events, T>>;
468
465
  }
469
466
 
470
- export { FastEvent, type FastEventListenOptions, type FastEventListener, type FastEventListenerMeta, type FastEventMessage, type FastEventOptions, FastEventScope, type FastEventSubscriber, type FastEvents, type FastListenerNode, type FastListeners, type ScopeEvents };
467
+ export { FastEvent, type FastEventListenOptions, type FastEventListener, type FastEventMessage, type FastEventOptions, FastEventScope, type FastEventSubscriber, type FastEvents, type FastListenerNode, type FastListeners, type ScopeEvents };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fastevent",
3
- "version": "1.1.2",
3
+ "version": "1.1.3",
4
4
  "description": "fast event emitter",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
package/src/types.ts CHANGED
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
 
4
- export type FastEventMessage<T = string, P = any, M = unknown> = {
4
+ export interface FastEventMessage<T = string, P = any, M = unknown> {
5
5
  type: T
6
6
  payload: P
7
7
  meta: M
@@ -25,9 +25,6 @@ export type FastEventSubscriber = {
25
25
  off: () => void
26
26
  }
27
27
 
28
- export interface FastEventListenerMeta {
29
- emitter?: string
30
- }
31
28
 
32
29
  export type FastListeners = FastListenerNode
33
30