- Source:
Event-based functionality.
Methods
ish.io.event.fire(sEvent, a_vArgumentsopt) → {boolean}
- Source:
Fires the passed event, executing any registered functions with the passed arguments.
AKA: ish.io.event
Parameters:
Name |
Type |
Attributes |
Description |
sEvent |
string
|
|
Value representing the name of the event. |
a_vArguments |
arguments
|
Array.<variant>
|
<optional>
|
Value representing the arguments to pass into the event's registered functions. Note: This value is passed through ish.type.fn.convert to ensure an array. |
Returns:
Type |
Description |
boolean
|
Value representing if any registered functions were executed. |
ish.io.event.fired(sEvent) → {boolean}
- Source:
Determines if the passed event has been previously fired.
Note: During the first call, ish.io.event.fired
will return false
to indicate this is the first run of the event.
Parameters:
Name |
Type |
Description |
sEvent |
string
|
Value representing the name of the event. |
Returns:
Type |
Description |
boolean
|
Value representing if the passed event has been previously fired. |
ish.io.event.registered(sEvent, fnCallback) → {boolean}
- Source:
Determines if the passed callback is registered against passed event.
Parameters:
Name |
Type |
Description |
sEvent |
string
|
Value representing the name of the event. |
fnCallback |
function
|
Function that may be registered against the event. |
Returns:
Type |
Description |
boolean
|
Value representing if the passed callback is registered against the event. |
ish.io.event.unregister(sEvent) → {boolean}
- Source:
Unregisters the passed event.
Parameters:
Name |
Type |
Description |
sEvent |
string
|
Value representing the name of the event. |
Returns:
Type |
Description |
boolean
|
Value representing if the passed event has been successfully unregistered. |
ish.io.event.unwatch(sEvent, fnCallback) → {boolean}
- Source:
Unregisters the passed callback from the passed event.
Parameters:
Name |
Type |
Description |
sEvent |
string
|
Value representing the name of the event. |
fnCallback |
function
|
Function to unregister against the event. |
Returns:
Type |
Description |
boolean
|
Value representing if the passed callback was successfully unregistered against the event. |
ish.io.event.watch(sEvent, fnCallback) → {boolean}
- Source:
Watches the passed event, executing the passed function whenever the event is fired.
Note: The passed function will be executed immediately if the passed event has been previously fired.
Parameters:
Name |
Type |
Description |
sEvent |
string
|
Value representing the name of the event. |
fnCallback |
function
|
Function to execute whenever the event is fired, accepting the arguments passed into ish.io.event.fire and executed with { name: sEvent, count: iEventCallCount } as this . |
Returns:
Type |
Description |
boolean
|
Value representing if the passed function was successfully registered against the event. |