Added default wildcard types
parent
5a5fc74ddd
commit
ed94f6dcd2
|
@ -21,13 +21,13 @@ export class SingletonEvent implements Event<SingletonEvents, "singletone-instan
|
||||||
as<T extends keyof SingletonEvents>() : SingletonEvents[T] { return; }
|
as<T extends keyof SingletonEvents>() : SingletonEvents[T] { return; }
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface EventReceiver<Events> {
|
export interface EventReceiver<Events = { [key: string]: any }> {
|
||||||
fire<T extends keyof Events>(event_type: T, data?: Events[T], overrideTypeKey?: boolean);
|
fire<T extends keyof Events>(event_type: T, data?: Events[T], overrideTypeKey?: boolean);
|
||||||
fire_async<T extends keyof Events>(event_type: T, data?: Events[T], callback?: () => void);
|
fire_async<T extends keyof Events>(event_type: T, data?: Events[T], callback?: () => void);
|
||||||
}
|
}
|
||||||
|
|
||||||
const event_annotation_key = guid();
|
const event_annotation_key = guid();
|
||||||
export class Registry<Events> implements EventReceiver<Events> {
|
export class Registry<Events = { [key: string]: any }> implements EventReceiver<Events> {
|
||||||
private readonly registryUuid;
|
private readonly registryUuid;
|
||||||
|
|
||||||
private handler: {[key: string]: ((event) => void)[]} = {};
|
private handler: {[key: string]: ((event) => void)[]} = {};
|
||||||
|
|
Loading…
Reference in New Issue