Fix readme for webassembly usage. (#425)

Needs to do `getElementById()`, not just have the ID name.
Not sure if this is a winit change or what.
This commit is contained in:
icefoxen 2018-03-22 12:56:21 -04:00 committed by Pierre Krieger
parent 559681b0ed
commit 5dcde83b4c

View file

@ -50,6 +50,6 @@ Building a binary will yield a `.js` file. In order to use it in an HTML file, y
- Put a `<canvas id="my_id"></canvas>` element somewhere. A canvas corresponds to a winit "window". - Put a `<canvas id="my_id"></canvas>` element somewhere. A canvas corresponds to a winit "window".
- Write a Javascript code that creates a global variable named `Module`. Set `Module.canvas` to - Write a Javascript code that creates a global variable named `Module`. Set `Module.canvas` to
the ID of the `<canvas>` element (in the example this would be `"my_id"`). More information the element of the `<canvas>` element (in the example you would retrieve it via `document.getElementById("my_id")`).
[here](https://kripken.github.io/emscripten-site/docs/api_reference/module.html). More information [here](https://kripken.github.io/emscripten-site/docs/api_reference/module.html).
- Make sure that you insert the `.js` file generated by Rust after the `Module` variable is created. - Make sure that you insert the `.js` file generated by Rust after the `Module` variable is created.