/*
* pettanR system.js
- * version 0.5.20
+ * version 0.5.21
*
* gadgetOS
* author:
removeEventListener : function( eventType, handler ){
var events = this.events,
counter = this.rootData.eventCounter,
- type, list, i;
+ type, list, i = 0;
if( events === null ) return;
console.log( ' *** remove ' + eventType );
for( type in events ){
list = events[ type ];
if( eventType && eventType !== type ) continue;
- for( i = 0; i < list.length; ){
+ for( ; i < list.length; ){
if( list[ i ].destroy( type, handler ) === true ){
console.log( ' *** removed! ' + type );
list.splice( i, 1 );
// delete this[ type ];
delete events[ type ];
};
- --counter[ type ];
- if( counter[ type ] === 0 ){
- MouseEvent.remove( this.apiuser, this.rootData.elmMouseCatch, type, eventRellay );
- delete counter[ type ];
+ if( counter[ type ] ){
+ --counter[ type ];
+ if( counter[ type ] === 0 ){
+ MouseEvent.remove( this.apiuser, this.rootData.elmMouseCatch, type, eventRellay );
+ delete counter[ type ];
+ };
};
- };
+ };
},
_eventRellay : function( x, y, e, eventType ){
if( this._disabled === true ) return false;
};
return this._scrollY;
},
- remove : function(){
- if( this === this.rootData ) return;
- var parent = this.parentData,
- list = NodePrivateData.dataList,
- nodes = this.childData,
- node;
- this._destroy();
- if( parent.hitChild === this ) parent.hitChild = null;
- if( parent.childData.length === 0 ) delete parent.childData;
- parent.clip === false && parent._updateRectangle();
- },
- _destroy : function(){
- var nodes = this.childData,
- list = NodePrivateData.dataList,
- node;
- this.removeEventListener();
- if( nodes ){
- while( node = nodes.shift() ) node._destroy();
- };
- list.splice( Util.getIndex( list, this ), 1 );
- if( !this.parentData ) return;
- nodes = this.parentData.childData;
- nodes.splice( Util.getIndex( nodes, this ), 1 );
- },
nodeIndex : function( v ){
var list, i;
if( !this.parentData ) return 0;
this._childDisabled = v;
};
return this._childDisabled;
+ },
+ remove : function(){
+ if( this === this.rootData ) return;
+ var parent = this.parentData,
+ nodes = parent.childData;
+ this._destroy();
+ if( parent.hitChild === this ) delete parent.hitChild;
+ nodes.splice( Util.getIndex( nodes, this ), 1 );
+ if( nodes.length === 0 ) delete parent.childData;
+ parent.clip === false && parent._updateRectangle();
+ },
+ _destroy : function(){
+ var nodes = this.childData,
+ list = NodePrivateData.dataList,
+ node;
+ this.removeEventListener();
+ if( nodes ){
+ while( node = nodes.shift() ) node._destroy();
+ delete this.childData;
+ };
+ list.splice( Util.getIndex( list, this ), 1 );
}
};
NodePrivateData.dataList = [];
var data = NodePrivateData.get( root );
MouseEvent.remove( data.apiuser, data.elmMouseCatch, 'mousemove', eventRellay );
body.removeChild( data.elmMouseCatch );
- NodePrivateData.get( root )._destroy();
- ROOT_LIST.splice( Util.getIndex( ROOT_LIST, root ), 1 );
+ data._destroy();
+ ROOT_LIST.splice( Util.getIndex( ROOT_LIST, data ), 1 );
+ if( currentRootData === data ){
+ currentRootData = null;
+ targetNodeData = null;
+ forceNodeData = null;
+ };
},
onSystemShutdown : function(){
this.shutdown = function(){
if( !application ) return false;
- if( ( isOverlay === true ? Overlay.hide() : application.close() ) === false ) return false;
- application = null;
+ AsyncCall.add( application, ( isOverlay === true ? Overlay.hide : application.close ) );
};
};