| Package | org.mvcexpress.messenger |
| Class | public class Messenger |
| Inheritance | Messenger Object |
| Method | Defined 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 | ||
| allowInstantiation | property |
pureLegsCore static var allowInstantiation:Boolean = false| Messenger | () | Constructor |
public function Messenger()CONSTRUCTOR - internal class. Not available for use.
| addHandler | () | method |
public function addHandler(type:String, handler:Function, handlerClassName:String = null):HandlerVOAdds 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.
|
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):StringList all message mappings. Intended to be used by ModuleCore.as
Parameters
commandMap:CommandMap |
String |
| removeHandler | () | method |
public function removeHandler(type:String, handler:Function):voidRemoves 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):voidRuns 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.
|