-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: pass context to publisher alongside events
- Loading branch information
1 parent
9eb110f
commit 8c0b5c5
Showing
4 changed files
with
45 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,23 @@ | ||
import { IEvent } from './event.interface'; | ||
|
||
export interface IEventPublisher<EventBase extends IEvent = IEvent> { | ||
publish<T extends EventBase = EventBase>(event: T): any; | ||
publishAll?<T extends EventBase = EventBase>(events: T[]): any; | ||
/** | ||
* Publishes an event. | ||
* @param event The event to publish. | ||
* @param context The context. | ||
*/ | ||
publish<TEvent extends EventBase, TContext = unknown>( | ||
event: TEvent, | ||
context?: TContext, | ||
): any; | ||
|
||
/** | ||
* Publishes multiple events. | ||
* @param events The events to publish. | ||
* @param context The context. | ||
*/ | ||
publishAll?<TEvent extends EventBase, TContext = unknown>( | ||
events: TEvent[], | ||
context?: TContext, | ||
): any; | ||
} |