Constructor
new EventBus()
- Description:
- Creates a new event bus.
- Source:
Example
const eventbus = new EventBus();
eventbus.trigger(EVENT);
eventbus.listen(EVENT, handler);
Methods
listen($event, $handler) → {this}
- Description:
- Listens an event.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
$event |
TypeGeneric | The event to listen. |
$handler |
TypeListener | The listener to add. |
Returns:
- Type
- this
trigger($event) → {this}
- Description:
- Triggers an event.
- Source:
Parameters:
| Name | Type | Description |
|---|---|---|
$event |
TypeGeneric | The event to trigger. |
Returns:
- Type
- this