Messager
A messager is a managed dictionary that notifies listeners when specific entries in the dictionary are updated. The messager contains functions for setting, getting, listening and notifying of data changes.
Constructor Summary
Public Constructor | ||
public |
|
Method Summary
Public Methods | ||
public |
Returns the data at a location in the dictionary specified by the key. |
|
public |
Notifies all listeners currently waiting on updates at the location of the dictionary key. |
|
public |
Updates the data at a specific location in the Messager storage dictionary. |
|
public |
Listens to a position in the dictionary for updates. |
Public Constructors
public constructor() source
Public Methods
public get(key: string): * source
Returns the data at a location in the dictionary specified by the key.
Params:
Name | Type | Attribute | Description |
key | string | Dictionary key name. |
Return:
* |
public notify(key: string) source
Notifies all listeners currently waiting on updates at the location of the dictionary key.
Params:
Name | Type | Attribute | Description |
key | string | Dictionary key name. |
public set(key: string, data: *) source
Updates the data at a specific location in the Messager storage dictionary. If there are listeners, notify them.
Params:
Name | Type | Attribute | Description |
key | string | Dictionary key name. |
|
data | * | Data to set. |
public watch(key: string, callback: function, notifyNow: boolean): function source
Listens to a position in the dictionary for updates. The callback passed to the function is called whenever the position defined by the dictionary key is updated.
By default, notifies the callback of the current data upon watching.