CEvent

View source

Represents one typed event payload as an event record.

Constructing the record stores the supplied value without queuing or publishing it. Use Events and Events#write when the payload should be queued for event readers.

Examples

import { CEvent } from '@wimaengine/event'

const payload = { amount: 10 }
const event = new CEvent(payload)

console.log(event.data === payload) // true
console.log(event.data.amount) // 10

Constructor


constructor<T>(data: T)

View source

Creates an event record around data.

Construction stores only the supplied value. To make a payload readable from an Events resource, pass it to Events#write.

Type Parameters

T

Parameters

NameDescriptionDefault
data

Typed payload to store.

—

Properties


data: T

View source

The original typed payload stored in this event record.

The value is stored by reference without cloning or freezing. Reassigning this public field changes the payload exposed by the wrapper.