Core 2.x

emit

Emits an event with the specified payload.

Arguments

Copied to clipboard!
emit(eventName, ...payload);

Argument Type Description
eventName
string
The name of the event
payload
any
Payload(s) to send with the event

Return

The KuzzleEventEmitter instance.

Usage

Copied to clipboard!
const eventEmitter = new KuzzleEventEmitter();
eventEmitter.addListener('helloEvent', msg => console.log(`Hello ${msg}`));
eventEmitter.emit('helloEvent', 'World');