I have a simple class
class A{
constructor(){
this.loadComponents().then(function(values) {callbackOnLoad();});
}
callbackOnLoad(){
//do some things
}
loadComponents(){
...
return Promise.all([p1,p2,p3,p4,p5,p6,p7,p8]);
}
}
I am unable to call callbackOnLoad after all promises are fulfilled. I know that "this" depends on the caller and so I understand why callbackOnLoad does not work. How can I solve this problem? How do I have to structure/design my code?