refactor event handling to consume base class for lifecycling
This commit is contained in:
11
src/infrastructure/Events/IEventSource.ts
Normal file
11
src/infrastructure/Events/IEventSource.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
export interface IEventSource<T> {
|
||||
on(handler: EventHandler<T>): IEventSubscription;
|
||||
}
|
||||
|
||||
export interface IEventSubscription {
|
||||
unsubscribe(): void;
|
||||
}
|
||||
|
||||
export type EventHandler<T> = (data: T) => void;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user