Home

Class mvc.Mediator

Instance Method Summary
broadcast(string message, <Any Type> opt_args)

broadcast the message to the listeners

isListened(string message) ⇒ boolean

check to see if anyone is listening for a message

off(number uid)

remove the listener by it's id

on((Array.<string>|null|string) message, ?Object fn, ?Object= opt_handler) ⇒ ?number

the message to listen for and the handler. Can either be a function to run or an object of the type: {init:Function, fn:Function, dispose:Function} which will run init when the message becomes available and dispose when a message is no longer supported. Returns a uid that can be used with off to remove the listener

once(string message, ?Function handler) ⇒ number

this will only run the function the first time the message is given

register(?Object obj, ?Array.<string> messages)

lets components know that a message can be fired by an object.

reset()

reset the mediator to it's original state

unregister(?Object obj, ?Array.<string>= opt_messages)

removes the object from the register for that message