fastevent 2.3.3 → 2.3.4
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 +8 -3
- package/dist/eventbus/index.d.ts +8 -3
- package/dist/eventbus/index.js.map +1 -1
- package/dist/eventbus/index.mjs.map +1 -1
- package/dist/index.d.mts +8 -3
- package/dist/index.d.ts +8 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -361,6 +361,8 @@ type TransformedEvents<Events extends Record<string, any>> = {
|
|
|
361
361
|
[K in keyof Events]: NotPayload<Events[K]>;
|
|
362
362
|
};
|
|
363
363
|
|
|
364
|
+
type Class = (new (...args: any[]) => any) | (abstract new (...args: any[]) => any);
|
|
365
|
+
|
|
364
366
|
type FastEventBusMessage<Events extends Record<string, any> = Record<string, any>, M = any> = FastEventEmitMessage<Events, M> & {
|
|
365
367
|
from?: string;
|
|
366
368
|
to?: string;
|
|
@@ -440,8 +442,8 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
440
442
|
once<T extends Types = Types>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
|
|
441
443
|
once<T extends Exclude<string, Types>>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
|
|
442
444
|
once<T extends keyof OmitTransformedEvents<Events>>(type: T, listener: TypedFastEventListener<Exclude<T, number | symbol>, Events[T], FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
|
|
443
|
-
once<T extends keyof PickTransformedEvents<Events>>(type: T, listener: (message: PickPayload<RecordValues<
|
|
444
|
-
once<T extends Exclude<string, Types>>(type: T, listener: TypedFastEventAnyListener<
|
|
445
|
+
once<T extends keyof PickTransformedEvents<Events>>(type: T, listener: (message: PickPayload<RecordValues<ClosestWildcardEvents<Events, Exclude<T, number | symbol>>>>, args: FastEventListenerArgs<Meta>) => any | Promise<any>, options?: FastEventListenOptions<Events, Meta>): FastEventSubscriber;
|
|
446
|
+
once<T extends Exclude<string, Types>>(type: T, listener: TypedFastEventAnyListener<ClosestWildcardEvents<Events, T>, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
|
|
445
447
|
onAny(options?: Pick<FastEventListenOptions, 'prepend'>): FastEventSubscriber;
|
|
446
448
|
onAny<P = any>(listener: TypedFastEventAnyListener<{
|
|
447
449
|
[K: string]: P;
|
|
@@ -512,6 +514,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
512
514
|
* ```
|
|
513
515
|
*/
|
|
514
516
|
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, M extends Record<string, any> = Record<string, any>, C = Context>(prefix: P, options?: DeepPartial<FastEventScopeOptions<Partial<FinalMeta> & M, C>>): FastEventScope<ScopeEvents<Events, P> & E, FinalMeta & M, C>;
|
|
517
|
+
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, C = Context, ScopeObject extends InstanceType<Class> = InstanceType<Class>>(prefix: P, scopeObj: ScopeObject, options?: DeepPartial<FastEventScopeOptions<Meta>>): FastEventScopeExtend<Events, P, ScopeObject>;
|
|
515
518
|
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, M extends Record<string, any> = Record<string, any>, C = Context, ScopeInstance extends FastEventScope<Record<string, any>, any, any> = FastEventScope<Record<string, any>, any, any>>(prefix: P, scopeObj: ScopeInstance, options?: DeepPartial<FastEventScopeOptions<Partial<FinalMeta> & M, C>>): ScopeInstance & FastEventScope<ScopeEvents<Events, P> & E, FinalMeta & M, C>;
|
|
516
519
|
/**
|
|
517
520
|
* 当on/once/onAny未指定监听器时,此为默认监听器
|
|
@@ -519,6 +522,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
519
522
|
*/
|
|
520
523
|
onMessage(message: TypedFastEventMessage<Events, FinalMeta>, args: FastEventListenerArgs<FinalMeta>): void;
|
|
521
524
|
}
|
|
525
|
+
type FastEventScopeExtend<Events extends Record<string, any>, Prefix extends string, T extends InstanceType<Class> = never> = FastEventScope<ScopeEvents<Events, Prefix>> & T;
|
|
522
526
|
|
|
523
527
|
/**
|
|
524
528
|
* FastEvent 事件发射器类
|
|
@@ -993,6 +997,7 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
|
|
|
993
997
|
*/
|
|
994
998
|
scope<P extends string>(prefix: P, options?: DeepPartial<FastEventScopeOptions<Meta, Context>>): FastEventScope<ScopeEvents<AllEvents, P>, Meta, Context>;
|
|
995
999
|
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, M extends Record<string, any> = Record<string, any>, C = Context>(prefix: P, options?: DeepPartial<FastEventScopeOptions<Meta & M, C>>): FastEventScope<ScopeEvents<AllEvents, P> & E, Meta & M, C>;
|
|
1000
|
+
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, C = Context, ScopeObject extends InstanceType<Class> = InstanceType<Class>>(prefix: P, scopeObj: ScopeObject, options?: DeepPartial<FastEventScopeOptions<Meta>>): FastEventScopeExtend<AllEvents, P, ScopeObject>;
|
|
996
1001
|
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, M extends Record<string, any> = Record<string, any>, C = Context, ScopeObject extends FastEventScope<any, any, any> = FastEventScope<any, any, any>>(prefix: P, scopeObj: ScopeObject, options?: DeepPartial<FastEventScopeOptions<Meta & M, C>>): ScopeObject & FastEventScope<ScopeEvents<AllEvents, P> & E, Meta & M, C>;
|
|
997
1002
|
}
|
|
998
1003
|
|
|
@@ -1252,4 +1257,4 @@ declare function isClass(target: unknown): target is new (...args: any[]) => any
|
|
|
1252
1257
|
|
|
1253
1258
|
declare function isFastEvent(target: any): target is FastEvent;
|
|
1254
1259
|
|
|
1255
|
-
export { AbortError, type AssertFastMessage, type AtPayloads, BroadcastEvent, CancelError, type ChangeFieldType, type ClosestWildcardEvents, type DeepPartial, type Dict, type Expand, type ExpandWildcard, type Fallback, FastEvent, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, FastEventListenerFlags, 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 FastMessagePayload, type Keys, type Merge, type MergeUnion, NamespaceDelimiter, NodeDataEvent, type NotPayload, type ObjectKeys, type OmitTransformedEvents, type OptionalItems, type Overloads, type OverrideOptions, type PickPayload, type PickTransformedEvents, QueueOverflowError, type RecordPrefix, type RecordValues, type RequiredItems, type ScopeEvents, TimeoutError, type TransformedEvents, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Unique, type WildcardEvents, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };
|
|
1260
|
+
export { AbortError, type AssertFastMessage, type AtPayloads, BroadcastEvent, CancelError, type ChangeFieldType, type Class, type ClosestWildcardEvents, type DeepPartial, type Dict, type Expand, type ExpandWildcard, type Fallback, FastEvent, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, FastEventListenerFlags, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeExtend, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type FastMessagePayload, type Keys, type Merge, type MergeUnion, NamespaceDelimiter, NodeDataEvent, type NotPayload, type ObjectKeys, type OmitTransformedEvents, type OptionalItems, type Overloads, type OverrideOptions, type PickPayload, type PickTransformedEvents, QueueOverflowError, type RecordPrefix, type RecordValues, type RequiredItems, type ScopeEvents, TimeoutError, type TransformedEvents, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Unique, type WildcardEvents, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };
|
package/dist/eventbus/index.d.ts
CHANGED
|
@@ -361,6 +361,8 @@ type TransformedEvents<Events extends Record<string, any>> = {
|
|
|
361
361
|
[K in keyof Events]: NotPayload<Events[K]>;
|
|
362
362
|
};
|
|
363
363
|
|
|
364
|
+
type Class = (new (...args: any[]) => any) | (abstract new (...args: any[]) => any);
|
|
365
|
+
|
|
364
366
|
type FastEventBusMessage<Events extends Record<string, any> = Record<string, any>, M = any> = FastEventEmitMessage<Events, M> & {
|
|
365
367
|
from?: string;
|
|
366
368
|
to?: string;
|
|
@@ -440,8 +442,8 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
440
442
|
once<T extends Types = Types>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
|
|
441
443
|
once<T extends Exclude<string, Types>>(type: T, options?: FastEventListenOptions<Events, FinalMeta>): FastEventSubscriber;
|
|
442
444
|
once<T extends keyof OmitTransformedEvents<Events>>(type: T, listener: TypedFastEventListener<Exclude<T, number | symbol>, Events[T], FinalMeta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
|
|
443
|
-
once<T extends keyof PickTransformedEvents<Events>>(type: T, listener: (message: PickPayload<RecordValues<
|
|
444
|
-
once<T extends Exclude<string, Types>>(type: T, listener: TypedFastEventAnyListener<
|
|
445
|
+
once<T extends keyof PickTransformedEvents<Events>>(type: T, listener: (message: PickPayload<RecordValues<ClosestWildcardEvents<Events, Exclude<T, number | symbol>>>>, args: FastEventListenerArgs<Meta>) => any | Promise<any>, options?: FastEventListenOptions<Events, Meta>): FastEventSubscriber;
|
|
446
|
+
once<T extends Exclude<string, Types>>(type: T, listener: TypedFastEventAnyListener<ClosestWildcardEvents<Events, T>, Meta, Fallback<Context, typeof this>>, options?: FastEventListenOptions): FastEventSubscriber;
|
|
445
447
|
onAny(options?: Pick<FastEventListenOptions, 'prepend'>): FastEventSubscriber;
|
|
446
448
|
onAny<P = any>(listener: TypedFastEventAnyListener<{
|
|
447
449
|
[K: string]: P;
|
|
@@ -512,6 +514,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
512
514
|
* ```
|
|
513
515
|
*/
|
|
514
516
|
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, M extends Record<string, any> = Record<string, any>, C = Context>(prefix: P, options?: DeepPartial<FastEventScopeOptions<Partial<FinalMeta> & M, C>>): FastEventScope<ScopeEvents<Events, P> & E, FinalMeta & M, C>;
|
|
517
|
+
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, C = Context, ScopeObject extends InstanceType<Class> = InstanceType<Class>>(prefix: P, scopeObj: ScopeObject, options?: DeepPartial<FastEventScopeOptions<Meta>>): FastEventScopeExtend<Events, P, ScopeObject>;
|
|
515
518
|
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, M extends Record<string, any> = Record<string, any>, C = Context, ScopeInstance extends FastEventScope<Record<string, any>, any, any> = FastEventScope<Record<string, any>, any, any>>(prefix: P, scopeObj: ScopeInstance, options?: DeepPartial<FastEventScopeOptions<Partial<FinalMeta> & M, C>>): ScopeInstance & FastEventScope<ScopeEvents<Events, P> & E, FinalMeta & M, C>;
|
|
516
519
|
/**
|
|
517
520
|
* 当on/once/onAny未指定监听器时,此为默认监听器
|
|
@@ -519,6 +522,7 @@ declare class FastEventScope<Events extends Record<string, any> = Record<string,
|
|
|
519
522
|
*/
|
|
520
523
|
onMessage(message: TypedFastEventMessage<Events, FinalMeta>, args: FastEventListenerArgs<FinalMeta>): void;
|
|
521
524
|
}
|
|
525
|
+
type FastEventScopeExtend<Events extends Record<string, any>, Prefix extends string, T extends InstanceType<Class> = never> = FastEventScope<ScopeEvents<Events, Prefix>> & T;
|
|
522
526
|
|
|
523
527
|
/**
|
|
524
528
|
* FastEvent 事件发射器类
|
|
@@ -993,6 +997,7 @@ declare class FastEvent<Events extends Record<string, any> = Record<string, any>
|
|
|
993
997
|
*/
|
|
994
998
|
scope<P extends string>(prefix: P, options?: DeepPartial<FastEventScopeOptions<Meta, Context>>): FastEventScope<ScopeEvents<AllEvents, P>, Meta, Context>;
|
|
995
999
|
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, M extends Record<string, any> = Record<string, any>, C = Context>(prefix: P, options?: DeepPartial<FastEventScopeOptions<Meta & M, C>>): FastEventScope<ScopeEvents<AllEvents, P> & E, Meta & M, C>;
|
|
1000
|
+
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, C = Context, ScopeObject extends InstanceType<Class> = InstanceType<Class>>(prefix: P, scopeObj: ScopeObject, options?: DeepPartial<FastEventScopeOptions<Meta>>): FastEventScopeExtend<AllEvents, P, ScopeObject>;
|
|
996
1001
|
scope<E extends Record<string, any> = Record<string, any>, P extends string = string, M extends Record<string, any> = Record<string, any>, C = Context, ScopeObject extends FastEventScope<any, any, any> = FastEventScope<any, any, any>>(prefix: P, scopeObj: ScopeObject, options?: DeepPartial<FastEventScopeOptions<Meta & M, C>>): ScopeObject & FastEventScope<ScopeEvents<AllEvents, P> & E, Meta & M, C>;
|
|
997
1002
|
}
|
|
998
1003
|
|
|
@@ -1252,4 +1257,4 @@ declare function isClass(target: unknown): target is new (...args: any[]) => any
|
|
|
1252
1257
|
|
|
1253
1258
|
declare function isFastEvent(target: any): target is FastEvent;
|
|
1254
1259
|
|
|
1255
|
-
export { AbortError, type AssertFastMessage, type AtPayloads, BroadcastEvent, CancelError, type ChangeFieldType, type ClosestWildcardEvents, type DeepPartial, type Dict, type Expand, type ExpandWildcard, type Fallback, FastEvent, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, FastEventListenerFlags, 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 FastMessagePayload, type Keys, type Merge, type MergeUnion, NamespaceDelimiter, NodeDataEvent, type NotPayload, type ObjectKeys, type OmitTransformedEvents, type OptionalItems, type Overloads, type OverrideOptions, type PickPayload, type PickTransformedEvents, QueueOverflowError, type RecordPrefix, type RecordValues, type RequiredItems, type ScopeEvents, TimeoutError, type TransformedEvents, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Unique, type WildcardEvents, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };
|
|
1260
|
+
export { AbortError, type AssertFastMessage, type AtPayloads, BroadcastEvent, CancelError, type ChangeFieldType, type Class, type ClosestWildcardEvents, type DeepPartial, type Dict, type Expand, type ExpandWildcard, type Fallback, FastEvent, FastEventBus, type FastEventBusEventTypes, type FastEventBusEvents, type FastEventBusMessage, FastEventBusNode, type FastEventBusNodeIds, type FastEventBusNodeOptions, type FastEventBusNodes, type FastEventBusOptions, FastEventDirectives, type FastEventEmitMessage, FastEventError, type FastEventListenOptions, type FastEventListener, type FastEventListenerArgs, FastEventListenerFlags, type FastEventListeners, type FastEventMessage, type FastEventMessageExtends, type FastEventMeta, type FastEventOptions, FastEventScope, type FastEventScopeExtend, type FastEventScopeMeta, type FastEventScopeOptions, type FastEventSubscriber, type FastEvents, type FastListenerMeta, type FastListenerNode, type FastListeners, type FastMessagePayload, type Keys, type Merge, type MergeUnion, NamespaceDelimiter, NodeDataEvent, type NotPayload, type ObjectKeys, type OmitTransformedEvents, type OptionalItems, type Overloads, type OverrideOptions, type PickPayload, type PickTransformedEvents, QueueOverflowError, type RecordPrefix, type RecordValues, type RequiredItems, type ScopeEvents, TimeoutError, type TransformedEvents, type TypedFastEventAnyListener, type TypedFastEventListener, type TypedFastEventMessage, type TypedFastEventMessageOptional, UnboundError, type Unique, type WildcardEvents, __FastEventScope__, __FastEvent__, __expandable__, expandable, isClass, isExpandable, isFastEvent, isFastEventMessage, isFastEventScope, isFunction, isPathMatched, isString, isSubsctiber };
|