update:
new code:
Ext.define(\'Fiddle.MyCmp\',{
extend:\'Ext.Component\'
,alias:\'widget.mycmp\'
,config:{
html:\'MyCmp\'
}
I suppose you want to destroy the component 5s after it is initialized. If so, the following code does it:
Ext.define('Fiddle.MyCmp',{
extend:'Ext.Component'
,alias:'widget.mycmp'
,config:{
html:'MyCmp'
}
,destroy:function() {
console.log('destroy override');
this.callParent(arguments);
}
,initialize:function() {
var me = this;
Ext.Function.defer(function(){
console.log('Destroying after delay')
me.destroy();
}, 5000, me);
}
});
Ext.application({
name : 'Fiddle',
ref:{
cmp: 'mycmp'
},
launch : function() {
Ext.Viewport.add({
xtype:'mycmp'
});
}
})