Observable

Observable

Observables allow Models to communicate with each other and store their states.

Constructor

new Observable()

Source:

Methods

listen(eventName, callback, unshiftopt) → {Listener}

Source:

Subscribe and consume event of a given Observable.

Binding.listen is preferred when inside a Binding.

Example
observable.listen("myEvent", message => { console.log(message) })
Parameters:
Name Type Attributes Default Description
eventName string
callback function
unshift boolean <optional>
false
Returns:
Type
Listener

emit(eventName, args)

Source:

Notify all Listeners of a given event

Example
observable.emit("myEvent", "Hello World")
Parameters:
Name Type Description
eventName string
args *

removeListener(listener)

Source:
Parameters:
Name Type Description
listener Listener