I am trying to call a generic function but when that function is executed I am in a different scope (window). This code will picture the case:
Ext.application({
name : 'Fiddle',
context: null,
function1 : function(){
this.function2(this.function3);
},
function2 : function(func){
func();
},
function3 : function(){
if(context == this){
Ext.Msg.alert('Fiddle', 'Same context!');
}
else {
Ext.Msg.alert('Fiddle', 'Different context!');
}
},
launch : function() {
context = this;
this.function1();
}
});
I am trying to use bind but it is not working.
Thanks!
EDIT: I am so sorry guys, I said Javascript instead of Sencha. I thought the issue would be the same in Javascript and I could get more help. I apologise. I created a code in fiddle to replicate the issue. Thanks to all the comments and help, they are really appreciated!