I am kinda new using javascript and I have this problem ..
In this IIFE
(function () {
this.something = "something"; // error - this is undefined
let loader = PIXI.loader;
loader.add('ace', "assets/spritesData.json");
loader.on('complete', onAssetsLoaded);
loader.load();
function onAssetsLoaded(){
this.gameSettings = GameSettings.getInstance();
createrenderer();
let rootView = new RootView(this._stage),
rootController = new RootController(rootView,this.gameSettings);
animate();
}
})();
Why "this" is undefined ? From what I know till now "this" right now this should be the current scope of the function ( in this case the anon function ) ?
Thanks in advance for the help.