OSDN Git Service

Version 0.6.16.
[pettanr/clientJs.git] / 0.6.x / js / core / 04_XClass.js
index 2c1af7d..543dbee 100644 (file)
@@ -90,7 +90,11 @@ X.Class = ( function(){
                                return;\r
                        };\r
                        killPrivateFlag = false; // onKill 内で PrivateInstance.kill() を防ぐため\r
-                       X.Type.isFunction( instance.onKill ) === true && instance.onKill();\r
+                       // onKill() === false の場合、kill のキャンセル\r
+                       // private      は false での キャンセル は無視される\r
+                       if( X.Type.isFunction( instance.onKill ) && instance.onKill() === false && !def.isPrivate ){\r
+                               return;\r
+                       };\r
                        for( p in instance ){\r
                                if( instance.hasOwnProperty && !instance.hasOwnProperty( p ) ) continue;\r
                                delete instance[ p ];\r
@@ -109,8 +113,6 @@ X.Class = ( function(){
                                        def.userList.splice( i, 1 );\r
                                };\r
                        };\r
-                       // myCallback の削除\r
-                       // myCallback を受け取った API への通知\r
                },\r
                instanceOf : function( klass ){\r
                        var Super = this;\r
@@ -154,6 +156,7 @@ X.Class = ( function(){
                        def.live && def.live.push( instance );\r
                };\r
                if( def.Super ){\r
+                       // klass.prototype に移動\r
                        instance.Super = def.SuperProto;\r
                        instance.SuperConstructor = superConstructor;\r
                };\r
@@ -162,7 +165,8 @@ X.Class = ( function(){
        };\r
        \r
        function superConstructor(){\r
-               X.Class._getClassDef( this ).SuperConstructor.apply( this, arguments );\r
+               var s = X.Class._getClassDef( this ).SuperConstructor;\r
+               s && s.apply( this, arguments );\r
        };\r
        \r
        return {\r