Class: abstract EventSync<P>
Abstract synchronous event class.
To create a custom event, extend the EventSync class.
You can override and customize the [payload]Event#payload getter if desired. Please read the documentation for the abstract Event class for the complete documentation.
For asynchronous events, see the EventAsync abstract class.
Example
// event payload type
type MyPayloadType = {id: number, active: boolean};
// event class
class MyEvent extends Event<MyPayloadType> {}
// create an event
const myEvent = new MyEvent({id: 1234, active: true});Extends
Event<P,void>
Type Parameters
| Type Parameter | Default type |
|---|---|
P | undefined |
Implements
Constructors
new EventSync()
new EventSync<
P>(payload?):EventSync<P>
Constructor
Parameters
| Parameter | Type | Description |
|---|---|---|
payload? | P | Payload to emit when the event is dispatched. |
Returns
EventSync<P>
Inherited from
Defined in
.tmp/repos/rockets/packages/nestjs-event/src/events/event.ts:69 (opens in a new tab)
Properties
| Property | Modifier | Type | Description | Inherited from |
|---|---|---|---|---|
expectsReturnOf | readonly | void | Internal Expects return of payload | EventSyncInterface.expectsReturnOf Event.expectsReturnOf |
Accessors
key
getkey():string
Event key.
Returns
string
The event key string.
Implementation of
Inherited from
Defined in
.tmp/repos/rockets/packages/nestjs-event/src/events/event.ts:55 (opens in a new tab)
payload
getpayload():P
Returns payload that was passed to the Event constructor.
Returns
P
The event payload.
Implementation of
EventSyncInterface.payload
Inherited from
Defined in
.tmp/repos/rockets/packages/nestjs-event/src/events/event.ts:85 (opens in a new tab)
key
getstatickey():string
Event key.
Returns
string
The event key string.
Inherited from
Defined in
.tmp/repos/rockets/packages/nestjs-event/src/events/event.ts:46 (opens in a new tab)