Commit fe365417 authored by techird's avatar techird

merge

parent f2d230d1
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
"MinderNode", "MinderNode",
"MinderEvent", "MinderEvent",
"require", "require",
"km" "km",
"console",
"Command"
] ]
} }
\ No newline at end of file
var mindermoduleDefaultTest = function(){ var mindermoduleDefaultTest = function(){
console.log("test loaded"); console.log("test loaded");
var stroredData="stored"; var stroredData="stored";
var TestCommand = kity.createClass({
});
TestCommand.queryState = function() {};
return { return {
"commands": { "commands": {
//todo:command字典,name-action 键值对模式编写 //todo:command字典,name-action 键值对模式编写
"testCommand":kity.createClass("testCommand",{ "testCommand":kity.createClass("testCommand",{
base:Command,
"execute":function(km,arg1,arg2,arg3){ "execute":function(km,arg1,arg2,arg3){
console.log(arg1,arg2,arg3); console.log(arg1,arg2,arg3);
} }
......
...@@ -29,10 +29,10 @@ var Command = kity.createClass( "Command", { ...@@ -29,10 +29,10 @@ var Command = kity.createClass( "Command", {
} }
}); });
Command.queryState: function(km) { Command.queryState = function(km) {
return 0; return 0;
} }
Command.queryValue: function(km) { Command.queryValue = function(km) {
return 0; return 0;
} }
\ No newline at end of file
...@@ -36,26 +36,29 @@ kity.extendClass(KityMinder, { ...@@ -36,26 +36,29 @@ kity.extendClass(KityMinder, {
if(_modules){ if(_modules){
for(var key in _modules){ for(var key in _modules){
//执行模块初始化,抛出后续处理对象 //执行模块初始化,抛出后续处理对象
var moduleDeals = var moduleDeals =
_modules[key].call(me); _modules[key].call(me);
console.log(moduleDeals); console.log(moduleDeals);
moduleDeals["ready"]&&moduleDeals["ready"].call(this); if(moduleDeals.ready)
{
moduleDeals.ready.call(me);
}
//command加入命令池子 //command加入命令池子
var moduleDealsCommands = moduleDeals["commands"]; var moduleDealsCommands = moduleDeals.commands;
if(moduleDealsCommands){ if(moduleDealsCommands){
for(var _key in moduleDealsCommands){ for(var _keyC in moduleDealsCommands){
me.commands[_key] = moduleDealsCommands[_key]; me.commands[_keyC] = moduleDealsCommands[_keyC];
} }
} }
//绑定事件 //绑定事件
var moduleDealsEvents = moduleDeals["events"]; var moduleDealsEvents = moduleDeals.events;
if(moduleDealsEvents){ if(moduleDealsEvents){
for(var _key in moduleDealsEvents){ for(var _keyE in moduleDealsEvents){
var bindEvs = _key.split(" "); var bindEvs = _keyE.split(" ");
var func = moduleDealsEvents[_key]; var func = moduleDealsEvents[_keyE];
for (var _i = 0; _i < bindEvs.length; _i++){ for (var _i = 0; _i < bindEvs.length; _i++){
me.on(bindEvs[_i],func); me.on(bindEvs[_i],func);
} }
...@@ -223,17 +226,20 @@ kity.extendClass(KityMinder, { ...@@ -223,17 +226,20 @@ kity.extendClass(KityMinder, {
var _action = new this.commands[name](); var _action = new this.commands[name]();
console.log(_action); console.log(_action);
var args = arguments; var args = arguments;
arguments[0] = this; args[0] = this;
_action["execute"]&&_action["execute"].apply(null,args); if(_action.execute){
_action.execute.apply(null,args);
}
this.actions.push(_action); this.actions.push(_action);
}, },
queryCommandState: function( name ) { queryCommandState: function( name ) {
this.commands[name].queryState(this); console.log(this.commands[name]);
(this.commands[name].queryState||Command.queryState)(this);
}, },
queryCommandValue: function( name ) { queryCommandValue: function( name ) {
this.commands[name].queryValue(this); (this.commands[name].queryValue||Command.queryValue)(this);
} }
}); });
......
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