Home > @idealeap/pipeline > EventEmitter > emit
EventEmitter.emit() method
Emits a specified event with the provided arguments, invoking all subscribed listeners for that event.
Signature:
typescript
emit(event: string, ...args: any[]): void;emit(event: string, ...args: any[]): void;Parameters
| Parameter | Type | Description |
|---|---|---|
| event | string | The name of the event to emit. |
| args | any[] | The arguments to pass to each listener function. |
Returns:
void
Example
js
const emitter = new EventEmitter();
emitter.emit('data', { message: 'Hello World' });const emitter = new EventEmitter();
emitter.emit('data', { message: 'Hello World' });