-
Notifications
You must be signed in to change notification settings - Fork 11
Quick start
To init framework we create class that extends CoreModule. We send main class object to constructor. We override startup() to start working.
in CoreModule sub-class or in Command sub-class you can set up your application.
modelMap.mapClass(modelClass:Class, injectClass:Class = null, name:String = "");
modelMap.mapObject(modelObject:Object, injectClass:Class = null, name:String = "");
modelMap.unmapClass(modelClass:Class, type:String = "");
mediatorMap.mapMediator(viewClass:Class, mediatorClass:Class);
mediatorMap.unmapMediator(viewClass:Class);
mediatorMap.mediate(viewObject:Object);
mediatorMap.unmediate(viewObject:Object);
commandMap.map(type:String, commandClass:Class);
commandMap.unmap(type:String, commandClass:Class);
CoreModele's, Command's, Mediator's, Module's can all send messages.
params is any object that will be passed to Commands execute() function, or to any handler listening for this message.
sendMessage(type:String, params:Object=null);
Only commands and mediators can listen for messages.
Maped commands are executed.
Mediators can add(remove) handle functios that are called then message is sent:
addHandler(type:String, handler:Function);
removeHandler(type:String, handler:Function);
handler functions must get single param:Object parameter. (you can type it to whatever you want.)
Your commands must extend Command class. They must have execute() function. execute() function must get single param:Object parameter. (you can type it to whatever you want.)
Commands is automaticaly executed to maped messages. or manualy with this command. (CoreModule's and Command's can use it...)
commandMap.execute(commandClass:Class, params:Object = null);
They can be injected with models with [Inject] metatag. (variable MUST be public)
[Inject] public var sampleEmptyModel:SampleEmptyModel;
Mediator must extend Mediator class.
They can be injected with models with [Inject] metatag. (variable MUST be public)
[Inject] public var sampleEmptyModel:SampleEmptyModel;
Also they injected with view object they are mediating.
[Inject] public var view:PureLegsSample;
Mediators overrides onRegister and onRemove functios to init and dispose them.
Must extend Model class.
They can be injected with models with [Inject] metatag. (variable MUST be public)
[Inject] public var sampleEmptyModel:SampleEmptyModel;