OSDN Git Service

Fix the bug of X.NodeAnime.
[pettanr/clientJs.git] / 0.6.x / js / 01_core / 12_XClosure.js
index 82ff4a9..deca998 100644 (file)
@@ -37,7 +37,7 @@ var __CallbackHash__ =
         * コールバックの種類を表す数値。 this + function, this.handleEvent, function only がある。\r
         * @type {number} \r
         */\r
-       kind : X_CLOSURE_THIS_FUNC,\r
+       cbKind : X_CLOSURE_THIS_FUNC,\r
        /**\r
         * コールバック。\r
         * @type {funciton|undefined} \r
@@ -47,7 +47,7 @@ var __CallbackHash__ =
         * コールバック名。コールバック作成時に関数が無い、関数が入れ替わっていても動作する。\r
         * @type {string|undefined} \r
         */\r
-       name : undefined,\r
+       funcName : undefined,\r
        /**\r
         * コールバックの this コンテキスト。 \r
         * @type {object|undefined}\r
@@ -73,14 +73,14 @@ function X_Closure_create( thisObject, opt_callback, opt_args /* [ listener || (
        var obj = X_Closure_classifyCallbackArgs( thisObject, opt_callback, opt_args ),\r
                l, ret, _obj;\r
        \r
-       if( !obj.kind ) return obj;\r
+       if( !obj.cbKind ) return obj;\r
        \r
        if( l = X_CLOSURE_POOL_LIST.length ){\r
                ret  = X_CLOSURE_POOL_LIST[ l - 1 ]; --X_CLOSURE_POOL_LIST.length; // ret = X_CLOSURE_POOL_LIST.pop();\r
                _obj = ret( X_Closure_COMMAND_BACK );\r
                \r
-               _obj.kind       = obj.kind;\r
-               _obj.name       = obj.name;\r
+               _obj.cbKind       = obj.cbKind;\r
+               _obj.funcName       = obj.funcName;\r
                _obj.func       = obj.func;\r
                _obj.context    = obj.context;\r
                _obj.supplement = obj.supplement;\r
@@ -98,38 +98,38 @@ function X_Closure_classifyCallbackArgs( arg1, arg2, arg3, alt_context ){
        var obj;\r
        \r
        if( X_Type_isObject( arg1 ) && X_Type_isFunction( arg2 ) ){\r
-               obj  = { context : arg1, func : arg2, kind : X_CLOSURE_THIS_FUNC };\r
+               obj  = { context : arg1, func : arg2, cbKind : X_CLOSURE_THIS_FUNC };\r
        } else\r
        if( X_Type_isObject( arg1 ) ){\r
                if( arg2 && X_Type_isString( arg2 ) ){\r
-                       obj  = { context : arg1, name : arg2, kind : X_CLOSURE_THIS_FUNCNAME };\r
+                       obj  = { context : arg1, funcName : arg2, cbKind : X_CLOSURE_THIS_FUNCNAME };\r
                } else {\r
-                       obj  = { context : arg1, kind : X_CLOSURE_HANDLEEVENT };\r
+                       obj  = { context : arg1, cbKind : X_CLOSURE_HANDLEEVENT };\r
                        arg3 = arg2;                    \r
                };\r
        } else\r
        if( X_Type_isFunction( arg1 ) ){\r
                arg3 = arg2;\r
                if( alt_context ){\r
-                       obj  = { context : alt_context, func : arg1, kind : X_CLOSURE_THIS_FUNC };\r
+                       obj  = { context : alt_context, func : arg1, cbKind : X_CLOSURE_THIS_FUNC };\r
                } else {\r
-                       obj  = { func : arg1, kind : X_CLOSURE_FUNC_ONLY };\r
+                       obj  = { func : arg1, cbKind : X_CLOSURE_FUNC_ONLY };\r
                };\r
        } else\r
        if( X_Type_isFunction( arg2 ) ){\r
                //console.log( 'X_Closure_classifyCallbackArgs : arg1 が ' + arg1 + 'です' ); ie4 で error\r
                if( alt_context ){\r
-                       obj  = { context : alt_context, func : arg2, kind : X_CLOSURE_THIS_FUNC };\r
+                       obj  = { context : alt_context, func : arg2, cbKind : X_CLOSURE_THIS_FUNC };\r
                } else {\r
-                       obj  = { func : arg2, kind : X_CLOSURE_FUNC_ONLY };\r
+                       obj  = { func : arg2, cbKind : X_CLOSURE_FUNC_ONLY };\r
                };\r
        } else\r
        if( alt_context && X_Type_isString( arg1 ) ){\r
                arg3 = arg2;\r
-               obj  = { context : alt_context, name : arg1, kind : X_CLOSURE_THIS_FUNCNAME };\r
+               obj  = { context : alt_context, funcName : arg1, cbKind : X_CLOSURE_THIS_FUNCNAME };\r
        } else\r
        if( alt_context ){\r
-               obj  = { context : alt_context, kind : X_CLOSURE_HANDLEEVENT };\r
+               obj  = { context : alt_context, cbKind : X_CLOSURE_HANDLEEVENT };\r
                arg3 = arg1;\r
        } else {\r
                console.log( '不正 ' + arg1 );\r
@@ -171,13 +171,13 @@ function X_Closure_proxyCallback( xfunc, _args ){
                args = temp;\r
        };\r
        \r
-       switch( xfunc.kind ){\r
+       switch( xfunc.cbKind ){\r
 \r
                case X_CLOSURE_THIS_FUNC :\r
                        return args.length === 0 ? func.call( thisObj ) : func.apply( thisObj, args );\r
                \r
                case X_CLOSURE_THIS_FUNCNAME :\r
-                       funcName = xfunc.name;\r
+                       funcName = xfunc.funcName;\r
                case X_CLOSURE_HANDLEEVENT :\r
                        funcName = funcName || 'handleEvent';\r
                        temp = thisObj[ funcName ];\r
@@ -208,21 +208,14 @@ function X_Closure_proxyCallback( xfunc, _args ){
 function X_Closure_correct( f ){\r
        var i = X_CLOSURE_LIVE_LIST.indexOf( f ),\r
                obj;\r
+\r
        if( i !== -1 ){\r
                X_CLOSURE_LIVE_LIST.splice( i, 1 );\r
                X_CLOSURE_POOL_LIST[ X_CLOSURE_POOL_LIST.length ] = f;\r
                obj = f( X_Closure_COMMAND_BACK );\r
-               /*\r
-               delete obj.kind;\r
-               if( obj.name ) delete obj.name;\r
-               if( obj.func ) delete obj.func;\r
-               if( obj.context ) delete obj.context;\r
-               if( obj.supplement ) delete obj.supplement;\r
-               delete obj.proxy; */\r
                X_Object_clear( obj );\r
                return true;\r
        };\r
-       return false;\r
 };\r
 \r
 function X_Closure_monitor(){\r