How does `this` work in phaser and its functions?

I seen that phaser has functions like preload, and by writing this, will give you other functions like to load image, audio and such. I’m a developer who are making a game using own library, and i wonder how did Phaser devs make that, so that right just after making a config variable, and creating new instance of Phaser.Game, and you can see
functions inside this., how did they get them there?


Interesting…Thanks for answering. Btw, are you one of the developers (contributors) of phaser? I’m asking because i want to know who to ask if i have a question about the way phaser works. :smiley:

Thanks for help
nikeedev (GitHub)
nikeedev (Website)

I’m an informal contributor. :smiley: You can ask on here or the Phaser Discord channel might be better.

The scene setup is complicated but a lot is done in Phaser.Scenes.Systems.init().