fastevent 2.2.7 → 2.2.8
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/dist/eventbus/index.d.mts +10 -7
- package/dist/eventbus/index.d.ts +10 -7
- package/dist/eventbus/index.js.map +1 -1
- package/dist/eventbus/index.mjs.map +1 -1
- package/dist/index.d.mts +10 -7
- package/dist/index.d.ts +10 -7
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -272,6 +272,9 @@ type Overloads<T> = Unique<T extends {
|
|
|
272
272
|
T
|
|
273
273
|
]>;
|
|
274
274
|
type Dict<V = any> = Record<Exclude<string, number | symbol>, V>;
|
|
275
|
+
type Union<T> = T extends infer O ? {
|
|
276
|
+
[K in keyof O]: O[K];
|
|
277
|
+
} : never;
|
|
275
278
|
|
|
276
279
|
type FastListenerExecutor = (listeners: FastListenerMeta[], message: TypedFastEventMessage, args: FastEventListenerArgs, execute: (listener: TypedFastEventListener, message: TypedFastEventMessage, args: FastEventListenerArgs, catchErrors?: boolean) => Promise<any> | any) => Promise<any[]> | any[];
|
|
277
280
|
|
|
@@ -296,7 +299,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
296
299
|
anyListener: TypedFastEventAnyListener<Events, FinalMeta, Fallback<Context, typeof this>>;
|
|
297
300
|
};
|
|
298
301
|
prefix: string;
|
|
299
|
-
emitter: FastEvent<
|
|
302
|
+
emitter: FastEvent<any>;
|
|
300
303
|
constructor(options?: DeepPartial<FastEventScopeOptions<FinalMeta, Context>>);
|
|
301
304
|
get context(): Fallback<Context, typeof this>;
|
|
302
305
|
get options(): FastEventScopeOptions<FinalMeta, Context>;
|
|
@@ -344,9 +347,9 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
344
347
|
emit(type: Types, directive: symbol): void;
|
|
345
348
|
emit(type: string, directive: symbol): void;
|
|
346
349
|
emit<R = any, T extends Types = Types>(type: T, payload?: Events[T], retain?: boolean): R[];
|
|
347
|
-
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[
|
|
350
|
+
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[T] : any, retain?: boolean): R[];
|
|
348
351
|
emit<R = any>(type: Types, payload?: Events[Types], options?: FastEventListenerArgs<FinalMeta>): R[];
|
|
349
|
-
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[
|
|
352
|
+
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[T] : any, options?: FastEventListenerArgs<FinalMeta>): R[];
|
|
350
353
|
emit<R = any>(message: FastEventEmitMessage<Events, FinalMeta>, options?: FastEventListenerArgs<FinalMeta>): R[];
|
|
351
354
|
emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
|
|
352
355
|
[K in T]: K extends Types ? Events[K] : any;
|
|
@@ -413,7 +416,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
413
416
|
* @template Meta - 事件元数据类型,默认为任意键值对对象
|
|
414
417
|
* @template Types - 事件类型的键名类型,默认为Events的键名类型
|
|
415
418
|
*/
|
|
416
|
-
declare class FastEvent<Events extends Record<string, any> = Record<string, any>, Meta extends Record<string, any> = Record<string, any>, Context = never, AllEvents extends Record<string, any> = Events & FastEvents
|
|
419
|
+
declare class FastEvent<Events extends Record<string, any> = Record<string, any>, Meta extends Record<string, any> = Record<string, any>, Context = never, AllEvents extends Record<string, any> = Expand<Events & FastEvents>, Types extends keyof AllEvents = Expand<Exclude<keyof AllEvents, number | symbol>>> {
|
|
417
420
|
__FastEvent__: boolean;
|
|
418
421
|
/** 事件监听器树结构,存储所有注册的事件监听器 */
|
|
419
422
|
listeners: FastListeners;
|
|
@@ -735,13 +738,13 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
|
|
|
735
738
|
emit<T extends Types = Types>(type: T, directive: symbol): any[];
|
|
736
739
|
emit(type: string, directive: symbol): any[];
|
|
737
740
|
emit<R = any, T extends Types = Types>(type: T, payload?: AllEvents[T], retain?: boolean): R[];
|
|
738
|
-
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[
|
|
741
|
+
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[T] : any, retain?: boolean): R[];
|
|
739
742
|
emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
|
|
740
743
|
[K in T]: K extends Types ? AllEvents[K] : any;
|
|
741
744
|
}, Meta>, retain?: boolean): R[];
|
|
742
745
|
emit<R = any>(message: FastEventEmitMessage<AllEvents, Meta>, retain?: boolean): R[];
|
|
743
746
|
emit<R = any, T extends Types = Types>(type: T, payload?: AllEvents[T], options?: FastEventListenerArgs<Meta>): R[];
|
|
744
|
-
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[
|
|
747
|
+
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[T] : any, options?: FastEventListenerArgs<Meta>): R[];
|
|
745
748
|
emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
|
|
746
749
|
[K in T]: K extends Types ? AllEvents[K] : any;
|
|
747
750
|
}, Meta>, options?: FastEventListenerArgs<Meta>): R[];
|
|
@@ -975,4 +978,4 @@ declare function isClass(target: unknown): target is new (...args: any[]) => any
|
|
|
975
978
|
|
|
976
979
|
declare function isFastEvent(target: any): target is FastEvent;
|
|
977
980
|
|
|
978
|
-
export { AbortError, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, FastEvent, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Unique, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };
|
|
981
|
+
export { AbortError, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, FastEvent, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Union, type Unique, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };
|
package/dist/index.d.ts
CHANGED
|
@@ -272,6 +272,9 @@ type Overloads<T> = Unique<T extends {
|
|
|
272
272
|
T
|
|
273
273
|
]>;
|
|
274
274
|
type Dict<V = any> = Record<Exclude<string, number | symbol>, V>;
|
|
275
|
+
type Union<T> = T extends infer O ? {
|
|
276
|
+
[K in keyof O]: O[K];
|
|
277
|
+
} : never;
|
|
275
278
|
|
|
276
279
|
type FastListenerExecutor = (listeners: FastListenerMeta[], message: TypedFastEventMessage, args: FastEventListenerArgs, execute: (listener: TypedFastEventListener, message: TypedFastEventMessage, args: FastEventListenerArgs, catchErrors?: boolean) => Promise<any> | any) => Promise<any[]> | any[];
|
|
277
280
|
|
|
@@ -296,7 +299,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
296
299
|
anyListener: TypedFastEventAnyListener<Events, FinalMeta, Fallback<Context, typeof this>>;
|
|
297
300
|
};
|
|
298
301
|
prefix: string;
|
|
299
|
-
emitter: FastEvent<
|
|
302
|
+
emitter: FastEvent<any>;
|
|
300
303
|
constructor(options?: DeepPartial<FastEventScopeOptions<FinalMeta, Context>>);
|
|
301
304
|
get context(): Fallback<Context, typeof this>;
|
|
302
305
|
get options(): FastEventScopeOptions<FinalMeta, Context>;
|
|
@@ -344,9 +347,9 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
344
347
|
emit(type: Types, directive: symbol): void;
|
|
345
348
|
emit(type: string, directive: symbol): void;
|
|
346
349
|
emit<R = any, T extends Types = Types>(type: T, payload?: Events[T], retain?: boolean): R[];
|
|
347
|
-
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[
|
|
350
|
+
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[T] : any, retain?: boolean): R[];
|
|
348
351
|
emit<R = any>(type: Types, payload?: Events[Types], options?: FastEventListenerArgs<FinalMeta>): R[];
|
|
349
|
-
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[
|
|
352
|
+
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? Events[T] : any, options?: FastEventListenerArgs<FinalMeta>): R[];
|
|
350
353
|
emit<R = any>(message: FastEventEmitMessage<Events, FinalMeta>, options?: FastEventListenerArgs<FinalMeta>): R[];
|
|
351
354
|
emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
|
|
352
355
|
[K in T]: K extends Types ? Events[K] : any;
|
|
@@ -413,7 +416,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
413
416
|
* @template Meta - 事件元数据类型,默认为任意键值对对象
|
|
414
417
|
* @template Types - 事件类型的键名类型,默认为Events的键名类型
|
|
415
418
|
*/
|
|
416
|
-
declare class FastEvent<Events extends Record<string, any> = Record<string, any>, Meta extends Record<string, any> = Record<string, any>, Context = never, AllEvents extends Record<string, any> = Events & FastEvents
|
|
419
|
+
declare class FastEvent<Events extends Record<string, any> = Record<string, any>, Meta extends Record<string, any> = Record<string, any>, Context = never, AllEvents extends Record<string, any> = Expand<Events & FastEvents>, Types extends keyof AllEvents = Expand<Exclude<keyof AllEvents, number | symbol>>> {
|
|
417
420
|
__FastEvent__: boolean;
|
|
418
421
|
/** 事件监听器树结构,存储所有注册的事件监听器 */
|
|
419
422
|
listeners: FastListeners;
|
|
@@ -735,13 +738,13 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
|
|
|
735
738
|
emit<T extends Types = Types>(type: T, directive: symbol): any[];
|
|
736
739
|
emit(type: string, directive: symbol): any[];
|
|
737
740
|
emit<R = any, T extends Types = Types>(type: T, payload?: AllEvents[T], retain?: boolean): R[];
|
|
738
|
-
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[
|
|
741
|
+
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[T] : any, retain?: boolean): R[];
|
|
739
742
|
emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
|
|
740
743
|
[K in T]: K extends Types ? AllEvents[K] : any;
|
|
741
744
|
}, Meta>, retain?: boolean): R[];
|
|
742
745
|
emit<R = any>(message: FastEventEmitMessage<AllEvents, Meta>, retain?: boolean): R[];
|
|
743
746
|
emit<R = any, T extends Types = Types>(type: T, payload?: AllEvents[T], options?: FastEventListenerArgs<Meta>): R[];
|
|
744
|
-
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[
|
|
747
|
+
emit<R = any, T extends string = string>(type: T, payload?: T extends Types ? AllEvents[T] : any, options?: FastEventListenerArgs<Meta>): R[];
|
|
745
748
|
emit<R = any, T extends string = string>(message: FastEventEmitMessage<{
|
|
746
749
|
[K in T]: K extends Types ? AllEvents[K] : any;
|
|
747
750
|
}, Meta>, options?: FastEventListenerArgs<Meta>): R[];
|
|
@@ -975,4 +978,4 @@ declare function isClass(target: unknown): target is new (...args: any[]) => any
|
|
|
975
978
|
|
|
976
979
|
declare function isFastEvent(target: any): target is FastEvent;
|
|
977
980
|
|
|
978
|
-
export { AbortError, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, FastEvent, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Unique, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };
|
|
981
|
+
export { AbortError, CancelError, type ChangeFieldType, type DeepPartial, type Dict, type Expand, type Fallback, FastEvent, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type Merge, type ObjectKeys, type OptionalItems, type Overloads, type OverrideOptions, type PickScopeEvents, QueueOverflowError, type RequiredItems, type ScopeEvents, TimeoutError, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Union, type Unique, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };
|