Skip to content

DomainEvent

Christian Prinz edited this page Oct 17, 2022 · 1 revision

Class: DomainEvent<Payload>

An event passed from an EventHandler to a Subscriber. Usually this will not be created manually but automatically while dispatching events at the EventHandler

Type parameters

Name
Payload

Hierarchy

Table of contents

Constructors

Properties

Accessors

Methods

Constructors

constructor

new DomainEvent<Payload>(name, payload)

Type parameters

Name
Payload

Parameters

Name Type
name string
payload Payload

Overrides

Serializable.constructor

Defined in

event/DomainEvent.ts:31

Properties

_id

Private _id: string

Defined in

event/DomainEvent.ts:8


_name

Private _name: string

Defined in

event/DomainEvent.ts:13


_payload

Private _payload: Payload

Defined in

event/DomainEvent.ts:25


_timestamp

Private _timestamp: Date

Defined in

event/DomainEvent.ts:19

Accessors

id

get id(): string

Returns

string

Defined in

event/DomainEvent.ts:9


name

get name(): string

The name of the EventHandler which dispatched this event

Returns

string

Defined in

event/DomainEvent.ts:15


payload

get payload(): Payload

the payload which was given while dispatching the event

Returns

Payload

Defined in

event/DomainEvent.ts:27


timestamp

get timestamp(): Date

the Date this event was dispatched at the EventHandler

Returns

Date

Defined in

event/DomainEvent.ts:21

Methods

toJSON

toJSON(): Record<any, any>

reduces the Serializable to its private ("underscored") attributes. All non-underscored attributes and methods will be omitted.

This method overrides the built-in toJSON() which is primarily used in JSON.stringify()

Returns

Record<any, any>

an object containing all private attributes

Inherited from

Serializable.toJSON

Defined in

Serializable.ts:10

DDD basics - v0.0.1

Clone this wiki locally