Commit 87a53298 authored by Akikonata's avatar Akikonata

added closure

parent 94a01e2e
......@@ -20,9 +20,10 @@ var KityMinder = km.KityMinder = kity.createClass("KityMinder", {
//模块注册&暴露模块接口
(function(){
var _modules = {};
var _modules;
KityMinder.registerModule = function( name, module ) {
//初始化模块列表
if(!_modules){_modules = {};}
_modules[name] = module;
};
KityMinder.getModules = function(){
......@@ -34,7 +35,6 @@ var KityMinder = km.KityMinder = kity.createClass("KityMinder", {
kity.extendClass(KityMinder, (function(){
var _commands = {};//command池子
var _query = {};//query池子
return {
_initModules: function() {
var _modules = KityMinder.getModules();
......@@ -74,15 +74,16 @@ kity.extendClass(KityMinder, (function(){
}
},
execCommand: function( name ) {
var me = this;
var _action = new _commands[name]();
console.log(_action);
var args = arguments;
args[0] = this;
if(_action.execute){
_action.fire("beforecommand");
_action.on("precommand",function(e){
_action.execute.apply(null,args);
_action.fire("command");
me.fire("beforecommand",_action);
me.on("precommand",function(e){
if(e.target===_action){_action.execute.apply(null,args);}
me.fire("command",_action);
});
}
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment