I need to use Box2D.js in a strict-mode environment. Put "use strict"; at the top of box2d.js and it fails with "cannot set property 'Module' of undefined", due to the use of "this" to refer to global namespace which is not allowed in strict mode.
To work around this I have to remove a weird try/catch which tries to assign this.Module (why?) and remove the assignment of this.Box2D at the end. Then I add "var Module = {};" to the top.
Further the script proceeds to clobber pretty much every two-letter global variable, which causes random weird errors if incorporated in to a large existing JS codebase. It really ought to go in its own closure.
I need to use Box2D.js in a strict-mode environment. Put "use strict"; at the top of box2d.js and it fails with "cannot set property 'Module' of undefined", due to the use of "this" to refer to global namespace which is not allowed in strict mode.
To work around this I have to remove a weird try/catch which tries to assign this.Module (why?) and remove the assignment of this.Box2D at the end. Then I add "var Module = {};" to the top.
Further the script proceeds to clobber pretty much every two-letter global variable, which causes random weird errors if incorporated in to a large existing JS codebase. It really ought to go in its own closure.