mirror of
https://github.com/hajimehoshi/ebiten.git
synced 2025-02-01 05:24:27 +01:00
Updated WebAssembly (markdown)
parent
43a4af26f1
commit
30279bf2dd
@ -1,14 +1,31 @@
|
||||
This document is TBD. Write about Go 1.11 beta.
|
||||
As there are differences between the latest Go and Go 1.11 beta, I recommend to use the latest Go here.
|
||||
|
||||
# Get the latest Go
|
||||
|
||||
1. Checkout [neelance's wasm-wip branch of the Go compiler](https://github.com/neelance/go/tree/wasm-wip)
|
||||
2. Compile the compiler by running `./all.bash`
|
||||
1. Checkout the latest Go (https://go.googlesource.com/go)
|
||||
2. Compile the compiler by running `./make.bash`
|
||||
|
||||
After that, use the compiled `go` binary.
|
||||
|
||||
# Get the template HTML
|
||||
# Create an HTML
|
||||
|
||||
https://github.com/neelance/go/tree/wasm-wip/misc/wasm
|
||||
```html
|
||||
<!DOCTYPE html>
|
||||
<script src="wasm_exec.js"></script>
|
||||
<script>
|
||||
// Polyfill
|
||||
if (!WebAssembly.instantiateStreaming) {
|
||||
WebAssembly.instantiateStreaming = async (resp, importObject) => {
|
||||
const source = await (await resp).arrayBuffer();
|
||||
return await WebAssembly.instantiate(source, importObject);
|
||||
};
|
||||
}
|
||||
|
||||
const go = new Go();
|
||||
WebAssembly.instantiateStreaming(fetch("sprites.wasm"), go.importObject).then(result => {
|
||||
go.run(result.instance);
|
||||
});
|
||||
</script>
|
||||
```
|
||||
|
||||
TBD
|
Loading…
Reference in New Issue
Block a user