#18576616 JAF의 cast 메소드를 중첩해서 사용할 경우 값을 제대로 반환하지 못하던 버그 수정

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7080 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
taggon 2009-12-30 05:16:35 +00:00
parent e4f0306a42
commit 72ca9d1ef6

View file

@ -114,7 +114,7 @@ _app_base = {
_plugins : [], _plugins : [],
_messages : [], _messages : [],
_fn_level : -1, _fn_level : [],
/** /**
* @brief register a plugin instance * @brief register a plugin instance
@ -150,7 +150,7 @@ _app_base = {
// binding // binding
oPlugin.cast = function(msg, params) { oPlugin.cast = function(msg, params) {
oPlugin._cast(msg, params); return oPlugin._cast(msg, params);
}; };
oPlugin.broadcast = function(msg, params) { oPlugin.broadcast = function(msg, params) {
@ -215,14 +215,12 @@ _app_base = {
msg = msg.toUpperCase(); msg = msg.toUpperCase();
// increase function level
this._fn_level++;
// BEFORE hooker // BEFORE hooker
if (aMsg['BEFORE_'+msg] || this['API_BEFORE_'+msg]) { if (aMsg['BEFORE_'+msg] || this['API_BEFORE_'+msg]) {
var bContinue = this._cast(sender, 'BEFORE_'+msg, params); var bContinue = this._cast(sender, 'BEFORE_'+msg, params);
if (!bContinue) { if (!bContinue) {
this._fn_level--; this._fn_level--;
console.log('-', msg, this._fn_level);
return; return;
} }
} }
@ -243,10 +241,7 @@ _app_base = {
this._cast(sender, 'AFTER_'+msg, params); this._cast(sender, 'AFTER_'+msg, params);
} }
// decrease function level if (!/^(?:AFTER_|BEFORE_)/.test(msg)) { // top level function
this._fn_level--;
if (this._fn_level < 0) { // top level function
return vRet; return vRet;
} else { } else {
if (typeof vRet == 'undefined') vRet = true; if (typeof vRet == 'undefined') vRet = true;
@ -261,7 +256,7 @@ _plugin_base = {
_cast : function(msg, params) { _cast : function(msg, params) {
if (this.oApp && this.oApp._cast) { if (this.oApp && this.oApp._cast) {
this.oApp._cast(this, msg, params || []); return this.oApp._cast(this, msg, params || []);
} }
}, },
_broadcast : function(msg, params) { _broadcast : function(msg, params) {