API Reference
Rockets Core API
nestjs-event
classes
EventSync

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

Type Parameters

Type ParameterDefault type
Pundefined

Implements

Constructors

new EventSync()

new EventSync<P>(payload?): EventSync<P>

Constructor

Parameters

ParameterTypeDescription
payload?PPayload to emit when the event is dispatched.

Returns

EventSync<P>

Inherited from

Event.constructor

Defined in

.tmp/repos/rockets/packages/nestjs-event/src/events/event.ts:69 (opens in a new tab)

Properties

PropertyModifierTypeDescriptionInherited from
expectsReturnOfreadonlyvoidInternal Expects return of payloadEventSyncInterface.expectsReturnOf Event.expectsReturnOf

Accessors

key

get key(): string

Event key.

Returns

string

The event key string.

Implementation of

EventSyncInterface.key

Inherited from

Event.key

Defined in

.tmp/repos/rockets/packages/nestjs-event/src/events/event.ts:55 (opens in a new tab)


payload

get payload(): P

Returns payload that was passed to the Event constructor.

Returns

P

The event payload.

Implementation of

EventSyncInterface.payload

Inherited from

Event.payload

Defined in

.tmp/repos/rockets/packages/nestjs-event/src/events/event.ts:85 (opens in a new tab)


key

get static key(): string

Event key.

Returns

string

The event key string.

Inherited from

Event.key

Defined in

.tmp/repos/rockets/packages/nestjs-event/src/events/event.ts:46 (opens in a new tab)