Ext.apply(Ext.QuickTips, { destroy : function(){ this.unregister(); Ext.destroy(this.getQuickTip()); } }); Ext.EventManager.on(window, "beforeunload", Ext.QuickTips.destroy ,Ext.QuickTips,{single:true}); //or equivalent
Functions in JavaScript are lexically rather than dynamically scoped. This means that they run in the scope in which they are defined, not the scope from which they are executed.