rism-ch/verovio — pull request #53 by ahwitz (2014-12-09 17:00:28+00:00)
Title: Alternate emscripten build flag for WebWorker compatibility

When trying to compile using Emscripten, the resulting .js file fails as a webworker for two reasons.

-First, the "Module" variable is not accessible outside the function wrapper created by verovio-wrapper-start/end.js.

-Second, the "window" variable is not accessible in the isolated WebWorker environment, thus the "unload" listener in verovio-proxy.js can not be included.

The pull request solves this by adding a "-w" flag for the build.sh script that triggers these two changes. Included is also a "verovio-webworker-proxy.js" file that has the "unload" listener commented out. I'm not sure how safe the latter fix is, and whether everything will be removed from memory, but I'm fairly certain the only way to communicate with a webworker is via the "onmessage" event. Thus, this can be implemented by developers, but in a file other than verovio-toolkit.js.