Skip to content

In webbrowser load WASM from same folder as JS#222

Open
bertdemiranda wants to merge 1 commit intokoute:masterfrom
bertdemiranda:WASM-URL
Open

In webbrowser load WASM from same folder as JS#222
bertdemiranda wants to merge 1 commit intokoute:masterfrom
bertdemiranda:WASM-URL

Conversation

@bertdemiranda
Copy link
Copy Markdown

This pull request addresses issue #131 "Question: how to specify the wasm path in the generated js file?".

In the current version it is assumed (when running inside a webbrowser)
that the WASM module is located in the default path,
which is not always the case (in my case I have a webserver serving
a number of different WASM modules in different paths).

This modification to src/wasm_runtime_standalone.js will do for
the webbrowser case the same as it already does for the NodeJS case:
to get the URL for the javascript file that is then itself running,
and then load the WASM module from the same directory.

The logic for getting the URL for the Javascript file I have
taken from this thread: https://stackoverflow.com/questions/3097644/can-code-in-a-javascript-file-know-its-own-domain-url .
Maybe there is now a better way to do this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant