PDA

View Full Version : things to do when destroying a class



dolittle
13 Nov 2009, 4:39 PM
Hi,

I know that ext manage garbage collection for me when destroying components but what about event listeners attached to elements and Ext tasks?

For example I'll refer to Ext.ux.Menu from Ext.Core examples (this question is related to ext but the example is simple and easy to explain). Do I need to do something manually if I want to destroy an Ext.ux.Menu instance?

The menu attach event listeners, for example:

this.el.on('click', function(ev, t) {
return this.fireEvent('click', ev, t, this);
}, this, {delegate: 'a'})

define hover handler:

this.el.hover(function() {
this.hideTask.cancel();
}, function() {
this.hideTask.delay(this.delay*1000);
}, this);

and tasks:

this.showTask = new Ext.util.DelayedTask(this.showMenu, this);
this.hideTask = new Ext.util.DelayedTask(function() {
this.showTask.cancel();
this.hideAll();
this.fireEvent('hide');
}, this);

Thanks

dolittle
15 Nov 2009, 3:31 AM
bump