Build our EventEmitter, usually call from children class
Event subscription
Name of event without the on prefix (ex: log to onLog event declared)
Subscriber Function
Optionaloptions: { signal?: AbortSignal }Optionalsignal?: AbortSignalOptional AbortSignal to stop this or multiple subscriptions in same time
Event subscription only one time, once time fired it's automatically unsubscribe
Name of event without the on prefix (ex: log to onLog event declared)
Subscriber Function
Optionaloptions: { signal?: AbortSignal }Optionalsignal?: AbortSignalOptional AbortSignal to stop this or multiple subscriptions in same time
A advanced EventEmitter which allows to declare event as natural function in the inheriting children class, function must start by
onprefix to be recognized as an event. The function can define a behavior by default, and user can choose to redefine this behavior, or add an additionnal subscription for this event. In addition you can unsubscribe to multiple events with anAbortControllerExample