Packageorg.mvcexpress.messenger
Classpublic class Messenger
InheritanceMessenger Inheritance Object

Handles framework communications.



Public Methods
 MethodDefined By
  
CONSTRUCTOR - internal class.
Messenger
  
addHandler(type:String, handler:Function, handlerClassName:String = null):HandlerVO
Adds handler function that will be called then message of specified type is sent.
Messenger
  
listMappings(commandMap:CommandMap):String
List all message mappings.
Messenger
  
removeHandler(type:String, handler:Function):void
Removes handler function that will be called then message of specified type is sent.
Messenger
  
send(type:String, params:Object = null, targetAllModules:Boolean = false):void
Runs all handler functions associated with message type, and send params object as single parameter.
Messenger
Property Detail
allowInstantiationproperty
pureLegsCore static var allowInstantiation:Boolean = false

Constructor Detail
Messenger()Constructor
public function Messenger()

CONSTRUCTOR - internal class. Not available for use.

Method Detail
addHandler()method
public function addHandler(type:String, handler:Function, handlerClassName:String = null):HandlerVO

Adds handler function that will be called then message of specified type is sent.

Parameters

type:String — message type to react to.
 
handler:Function — function called on sent message, this function must have one and only one parameter.
 
handlerClassName:String (default = null) — handler function owner class name. For debugging only.

Returns
HandlerVO — returns message data object. This object can be disabled instead of removing the handle with function. (disabling is much faster)
dispose()method 
pureLegsCore function dispose():void

listMappings()method 
public function listMappings(commandMap:CommandMap):String

List all message mappings. Intended to be used by ModuleCore.as

Parameters

commandMap:CommandMap

Returns
String
removeHandler()method 
public function removeHandler(type:String, handler:Function):void

Removes handler function that will be called then message of specified type is sent. - if handler is not found it fails silently.

Parameters

type:String — message type that handler had to react
 
handler:Function — function called on sent message.

send()method 
public function send(type:String, params:Object = null, targetAllModules:Boolean = false):void

Runs all handler functions associated with message type, and send params object as single parameter.

Parameters

type:String — message type to find needed handlers
 
params:Object (default = null) — parameter object that will be sent to all handler functions as single parameter.
 
targetAllModules:Boolean (default = false) — if true, will send message to all existing modules, by default message will be internal for current module only.