CustomEventAccess
Read-only Proxy namespace for the Custom Model's custom Events. Select an Event by its nonempty Name for JS Access to obtain a CustomEventEmitter, then call its emit function. An Event's parameters are passed in their definition order. External Event handlers can respond through the Custom Widget's exposed Event without referring to an internal Widget.
Unknown or empty names return undefined. Use 'ThresholdExceeded' in this.event to check membership. Object.keys, Reflect.ownKeys, for...in, and spread expose the defined nonempty names once each, in definition order. The namespace has no generic emit(name, ...) dispatch function.
The namespace has a null prototype. It provides no inherited hasOwnProperty function or $raw escape. Assignment, definition, deletion of existing members, prototype changes, and making it non-extensible are rejected. Deleting an unknown name succeeds without changing the namespace.
Each member lookup creates a new emitter object with an emit function whose name is emit. Save the emitter when a stable reference is needed. String conversion produces [object Event] without emitting any Event, including Events named toString or valueOf. Symbol.toPrimitive and Symbol.toStringTag support this conversion but are not namespace members and are not enumerated. Other symbols, including Symbol.iterator, return undefined. JSON serialization represents each Event as an empty object because its emit function is omitted; it does not emit Events.
this.event.ThresholdExceeded.emit(this.property.temperature);
const eventName = 'ThresholdExceeded';
if (eventName in this.event) {
this.event[eventName].emit(this.property.temperature);
}
console.log(this.event.ThresholdExceeded.emit.name); // 'emit'
console.log(String(this.event)); // '[object Event]'