diff --git a/bricks/utils.js b/bricks/utils.js index 17698c8..561b180 100644 --- a/bricks/utils.js +++ b/bricks/utils.js @@ -25,13 +25,13 @@ bricks.dom_on_off_observer=new MutationObserver((mutations)=>{ function handleRemoved(node) { if (node.nodeType !== 1) return; // 只处理元素节点 if (node.bricks_widget) { - console.log('**** widget removed', node); + console.log('**** widget removed', node.bricks_widget); node.bricks_widget.dispatch('domoff'); } // 遍历后代 for (let child of node.querySelectorAll('*')) { if (child.bricks_widget) { - console.log('**** widget removed (descendant)', child); + console.log('**** widget removed (descendant)', child.bricks_widget); child.bricks_widget.dispatch('domoff'); } } diff --git a/bricks/wterm.js b/bricks/wterm.js index e17fafe..f7cc504 100644 --- a/bricks/wterm.js +++ b/bricks/wterm.js @@ -18,10 +18,11 @@ bricks.Wterm = class extends bricks.JsWidget { this.bind('domoff', this.destroy.bind(this)); } destroy(){ + console.debug('------domoff event, destory this widget'); this.unbind('element_resize', this.term_resize.bind(this)) this.heartbeat_task.cancel(); this.heartbeat_task = null; - console.debug('------domoff event, destory this widget'); + console.debug('---1--domoff event, destory this widget'); if (this.socket){ console.log('socket alive, destroy it'); this.socket.send(JSON.stringify({ type: "close"})); @@ -32,11 +33,13 @@ bricks.Wterm = class extends bricks.JsWidget { this.socket.onclose = null; this.socket = null; } + console.debug('---2--domoff event, destory this widget'); if (this.term){ this.fitAddon.dispose(); this.term.dispose(); this.term = null; } + console.debug('---3--domoff event, destory this widget'); } charsize_sizing(){ var cs = bricks.app.charsize;