TyphonEvents
Extends:
TyphonEvents adds new functionality for trigger events. The following are new trigger mechanisms:
Please refer to the Events documentation for all inherited functionality.
triggerDefer - Defers invoking trigger.
triggerFirst - Only invokes the first target matched and passes back any result to the callee.
triggerResults - Invokes all targets matched and passes back an array of results in an array to the callee.
triggerThen - Invokes all targets matched and adds any returned results through Promise.all which returns
a single promise to the callee.
Method Summary
| Public Methods | ||
| public |
getEventbusName(): string | * Returns the current eventbusName. |
|
| public |
setEventbusName(name: string) Sets the eventbus name. |
|
| public |
Defers invoking |
|
| public |
triggerFirst(name: string): * Provides |
|
| public |
triggerResults(name: string): Array<*> Provides |
|
| public |
triggerThen(name: string): Promise Provides |
|
Inherited Summary
| From class Events | ||
| public |
bind(): * Delegates to |
|
| public |
Tell an object to listen to a particular event on an other object. |
|
| public |
listenToOnce(obj: object, name: string, callback: function): Events Just like |
|
| public |
Remove a previously-bound callback function from an object. |
|
| public |
Bind a callback function to an object. |
|
| public |
Just like |
|
| public |
stopListening(obj: object, name: string, callback: function): Events Tell an object to stop listening to events. |
|
| public |
Trigger callbacks for the given event, or space-delimited list of events. |
|
| public |
unbind(): * Delegates to |
|
Public Methods
public setEventbusName(name: string) source
Sets the eventbus name.
Params:
| Name | Type | Attribute | Description |
| name | string | The name for this eventbus. |
public triggerFirst(name: string): * source
Provides trigger functionality that only invokes the first target matched and passes back any result to
the callee.
Params:
| Name | Type | Attribute | Description |
| name | string | Event name(s) |
Return:
| * |
public triggerResults(name: string): Array<*> source
Provides trigger functionality, but collects any returned results from invoked targets in an array and passes
back this array to the callee.
Params:
| Name | Type | Attribute | Description |
| name | string | Event name(s) |
public triggerThen(name: string): Promise source
Provides trigger functionality, but collects any returned Promises from invoked targets and returns a
single Promise generated by Promise.all. This is a very useful mechanism to invoke asynchronous operations
over an eventbus.
Params:
| Name | Type | Attribute | Description |
| name | string | Event name(s) |