class AFrame.Observable
An Observable is the way events are done. Observables are very similar to DOM Events in that each object has a set of events that it can trigger. Objects that are concerned with a particular event register a callback to be called whenever the event is triggered. Observables allow for each event to have zero or many listeners, meaning the developer does not have to manually keep track of who to notify when a particular event happens. This completely decouples the triggering object from any objects that care about it.
Methods
| Methods | Returns | Description |
|---|---|---|
bind(
callback
)
|
id
|
↑
Bind a callback to the observable Parameters:
Returns: |
init(
)
|
void
|
↑
Initialize the observable |
isTriggered(
)
|
boolean
|
↑
Check whether the observable has been triggered Returns:
|
teardown(
)
|
void
|
↑
Tear the observable down, free references |
trigger(
optional
)
|
void
|
↑
Trigger the observable, calls any callbacks bound to the observable. Parameters:
|
unbind(
id
)
|
void
|
↑
Unbind an observable Parameters:
|
unbindAll(
)
|
void
|
↑
Unbind all observables |