new EventBus(name)
The event bus constructor
Parameters:
Name | Type | Description |
---|---|---|
name |
string | [description] |
- Source:
Members
(static) BusEvent
Return the BusEvent class
- Source:
(static) Errors
Return all the errors type
- Source:
name
- Source:
Methods
(static) deregister()
Deregister a function from the event bus
- Source:
- See:
(static) emit()
Emit an event to a channel
- Source:
- See:
(static) register()
Method used to register a callback function on a specific channel
- Source:
- See:
deregister(channel, listener)
Deregister a function from the event bus
Parameters:
Name | Type | Description |
---|---|---|
channel |
string | The listening channel |
listener |
function | The listener function |
- Source:
destroy()
Destroy the event bus
- Source:
emit(channel, data) → {EventBus}
Emit an event to a channel
Parameters:
Name | Type | Description |
---|---|---|
channel |
string | The event channel |
data |
* | The event data |
- Source:
Returns:
Returns the current instance of the EventBus
- Type
- EventBus
emitAsync(channel, data, delay=opt) → {EventBus}
Method to emit an event async
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
channel |
string | The event channel | |
data |
* | The event data | |
delay= |
number |
<optional> |
The delay until the event will be send |
- Source:
Returns:
Returns the current instance of the EventBus
- Type
- EventBus
emitEvent(event)
Emit a bus event
Parameters:
Name | Type | Description |
---|---|---|
event |
BusEvent | [description] |
- Source:
register(channel, listener, scope=opt, onceopt) → {function}
Method used to register a callback function on a specific channel
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
channel |
string | The given channel | ||
listener |
function | The callback function | ||
scope= |
function |
<optional> |
The callback function scope | |
once |
boolean |
<optional> |
false | If it should deregister after first event |
- Source:
Throws:
-
If [this condition is met]
Returns:
Returns a deregister function
- Type
- function
registerOnce(channel, listener, scope=opt) → {function}
Method used to register a callback function on a specific channel
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
channel |
string | The given channel | |
listener |
function | The callback function | |
scope= |
function |
<optional> |
The callback function scope |
- Source:
Throws:
-
If [this condition is met]
Returns:
Returns a deregister function
- Type
- function
resendDeadEvents()
Start resending 'dead' events
- Source: