Closed konsumer closed 1 year ago
I did some experiments. Module
is the var to use in all targets. it's a window-global in html, and it's defined in mjs. All things in the module (HEAP8
, etc) are defined in the mjs closure, actually, but Module
is a recursive reference to it.
I made this sound-lib with mjs, and it works in both.
I have updated the PR (#58 ) so I think we can close this.
Currently the sound code, for example, relies on having access to the
window
global-scope. This is fine for.html
output, since it uses a very old-school way of just pushing everything into the window, but for other targets (.mjs
, for example) multiple instances can be loaded on the same screen, and using globals like this will not work. It's not an immediate emergency, but we should look at how the instance is exposed in other targets and follow that, if we want to be able to load multiple games on a single page (for example, having multiple examples of pntr_app on the same page.)