Packagemvcexpress.core.messenger
Classpublic class Messenger
InheritanceMessenger Inheritance Object

FOR INTERNAL USE ONLY. Handles framework communications.



Protected Properties
 PropertyDefined By
  handlerRegistry : Dictionary
Messenger
  messageRegistry : Dictionary
Messenger
Public Methods
 MethodDefined By
  
Messenger($moduleName:String)
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
  
dispose():void
Disposes of messenger.
Messenger
  
hasHandler(type:String, handler:Function):Boolean
Checks if messanger has handler for this message type.
Messenger
  
isHandlerAdded(type:String, handler:Function):Boolean
Checks if handler is added to specific message type.
Messenger
  
listMappings(commandMap:CommandMap, verbose:Boolean = true):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):void
Runs all handler functions associated with message type, and send params object as single parameter.
Messenger
Property Detail
handlerRegistryproperty
protected var handlerRegistry:Dictionary

messageRegistryproperty 
protected var messageRegistry:Dictionary

Constructor Detail
Messenger()Constructor
public function Messenger($moduleName:String)

CONSTRUCTOR - internal class. Not available for use.

Parameters
$moduleName:String
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 
public function dispose():void

Disposes of messenger.

hasHandler()method 
public function hasHandler(type:String, handler:Function):Boolean

Checks if messanger has handler for this message type.

Parameters

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

Returns
Boolean — true if messenger has specific handler for message type.
isHandlerAdded()method 
public function isHandlerAdded(type:String, handler:Function):Boolean

Checks if handler is added to specific message type.

Parameters

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

Returns
Boolean
listMappings()method 
public function listMappings(commandMap:CommandMap, verbose:Boolean = true):String

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

Parameters

commandMap:CommandMap
 
verbose:Boolean (default = true)

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):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.