I’d like to ask you if there is another way to call function from a class where this INSTANCE of another class is coming from?
Or do you think my approach is correct?
class App(){
constructor(){
this.interface = new Interface();
}
refresh(){
...refresh app somehow...
}
}
class Interface(){
constructor(){}
changeInterface(){
...change interface somehow...
this.App.Refresh(); // => I need to call this function from previous class
}
}
var myGlobalVariable = new App();
myGlobalVariable.interface.changeInterface();
Only I can think of is to use global variable inside…but than I need to set this variable and use it all the time
var myGlobalVariable = new App();
myGlobalVariable.interface.changeInterface();
and use it in a Class
class Interface(){
constructor(){}
changeInterface(){
...change interface...
myGlobalVariable.App.Refresh(); // => call function from pre set
}
}
Or maybe my thinking is wrong and I have to change it?
Thanks.