Class: EventBus

EventBus()

EventBus provides a minimal publish/subscribe API for decoupled communication.

Constructor

new EventBus()

Create a new EventBus instance.
Source:

Classes

EventBus
EventBus

Methods

emit(event, data)

Emit an event
Parameters:
Name Type Description
event string Event name
data * Event data
Source:

emit(event, data)

Emit an event
Parameters:
Name Type Description
event string Event name
data * Event data
Source:

on(event, callback) → {function}

Subscribe to an event
Parameters:
Name Type Description
event string Event name
callback function Event handler function
Source:
Returns:
Unsubscribe function
Type
function

on(event, callback) → {function}

Subscribe to an event
Parameters:
Name Type Description
event string Event name
callback function Event handler function
Source:
Returns:
Unsubscribe function
Type
function

removeAllListeners(eventopt)

Remove all listeners for an event or all events
Parameters:
Name Type Attributes Description
event string <optional>
Event name (optional, removes all if not specified)
Source:

removeAllListeners(eventopt)

Remove all listeners for an event or all events
Parameters:
Name Type Attributes Description
event string <optional>
Event name (optional, removes all if not specified)
Source:

EventBusEventBus()

EventBus provides a minimal publish/subscribe API for decoupled communication.

Constructor

new EventBus()

Create a new EventBus instance.
Source:

Classes

EventBus
EventBus

Methods

emit(event, data)

Emit an event
Parameters:
Name Type Description
event string Event name
data * Event data
Source:

emit(event, data)

Emit an event
Parameters:
Name Type Description
event string Event name
data * Event data
Source:

on(event, callback) → {function}

Subscribe to an event
Parameters:
Name Type Description
event string Event name
callback function Event handler function
Source:
Returns:
Unsubscribe function
Type
function

on(event, callback) → {function}

Subscribe to an event
Parameters:
Name Type Description
event string Event name
callback function Event handler function
Source:
Returns:
Unsubscribe function
Type
function

removeAllListeners(eventopt)

Remove all listeners for an event or all events
Parameters:
Name Type Attributes Description
event string <optional>
Event name (optional, removes all if not specified)
Source:

removeAllListeners(eventopt)

Remove all listeners for an event or all events
Parameters:
Name Type Attributes Description
event string <optional>
Event name (optional, removes all if not specified)
Source: