You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In some code somewhere, the global canvas is being used, which requires this in host code, if you are not following all the assumptions emscripten makes:
window.canvas=canvas// do stuff that interacts with pntr and hope that nothing else is doing same at same time
This shows up especially, if users are using mjs target, since it self-contains all the scope. A better way to do it, in my opinion, is to always use Module which is a global in single-wasm code, but exposed inside the closure-scope in emscripten-modules. For example, here, Module.canvas is better than canvas.
Essentially, in module-mode, it's possible to have multiple instances of the wasm, with their own memory and screen loading async, but in the current system, there is a potential race-condition, if 2 instances need canvas at the same time (because it's a global.)
You can see an example of that here. Even though each instance has it's own canvas, they cross on init, so it's possible they will use the same canvas instead of their own, and sometimes, when loading 2 web-components on the same page, it will grab the wrong canvas to draw on.
In some code somewhere, the global
canvas
is being used, which requires this in host code, if you are not following all the assumptions emscripten makes:This shows up especially, if users are using mjs target, since it self-contains all the scope. A better way to do it, in my opinion, is to always use
Module
which is a global in single-wasm code, but exposed inside the closure-scope in emscripten-modules. For example, here,Module.canvas
is better thancanvas
.Essentially, in module-mode, it's possible to have multiple instances of the wasm, with their own memory and screen loading async, but in the current system, there is a potential race-condition, if 2 instances need canvas at the same time (because it's a global.)
You can see an example of that here. Even though each instance has it's own canvas, they cross on init, so it's possible they will use the same canvas instead of their own, and sometimes, when loading 2 web-components on the same page, it will grab the wrong canvas to draw on.
Related:
The text was updated successfully, but these errors were encountered: