Setu-TS
    Preparing search index...

    Interface IDomainEvents

    Records domain facts raised by one aggregate during its current operation.

    The recorder is local state only: application code decides when durable state is saved, whether pending events are dispatched or persisted, and when they are removed. It never publishes to an event bus itself.

    class Order {
    readonly events = createDomainEvents();

    place(): void {
    this.events.record(new OrderPlaced());
    }
    }

    0.6.0

    interface IDomainEvents {
        clear(): void;
        pending(): readonly IDomainEvent<unknown>[];
        record<T>(event: IDomainEvent<T>): void;
        remove(event: IDomainEvent): boolean;
    }
    Index