EventPublisher

  
class EventPublisher<EventBase extends IEvent = IEvent> {
  mergeClassContext<T extends Constructor<AggregateRoot<EventBase>>>(metatype: T, asyncContext?: AsyncContext): T
  mergeObjectContext<T extends AggregateRoot<EventBase>>(object: T, asyncContext?: AsyncContext): T
}

Methods

mergeClassContext()

Merge the event publisher into the provided class. This is required to make publish and publishAll available on the AggregateRoot class.


mergeClassContext<T extends Constructor<AggregateRoot<EventBase>>>(metatype: T, asyncContext?: AsyncContext): T

Parameters

Option Type Description
metatype T

The class to merge into.

asyncContext AsyncContext

The async context (if scoped).


Optional. Default is `undefined`.

Returns

T

mergeObjectContext()

Merge the event publisher into the provided object. This is required to make publish and publishAll available on the AggregateRoot class instance.


mergeObjectContext<T extends AggregateRoot<EventBase>>(object: T, asyncContext?: AsyncContext): T

Parameters

Option Type Description
object T

The object to merge into.

asyncContext AsyncContext

The async context (if scoped).


Optional. Default is `undefined`.

Returns

T