| Copyright 2018 The Go Authors. All rights reserved. |
| Use of this source code is governed by a BSD-style |
| license that can be found in the LICENSE file. |
| Add the following polyfill for Microsoft Edge 17/18 support: |
| <script src="https://cdn.jsdelivr.net/npm/text-encoding@0.7.0/lib/encoding.min.js"></script> |
| (see https://caniuse.com/#feat=textencoder) |
| <script src="wasm_exec.js"></script> |
| if (!WebAssembly.instantiateStreaming) { // polyfill |
| WebAssembly.instantiateStreaming = async (resp, importObject) => { |
| const source = await (await resp).arrayBuffer(); |
| return await WebAssembly.instantiate(source, importObject); |
| WebAssembly.instantiateStreaming(fetch("test.wasm"), go.importObject).then((result) => { |
| document.getElementById("runButton").disabled = false; |
| inst = await WebAssembly.instantiate(mod, go.importObject); // reset instance |
| <button onClick="run();" id="runButton" disabled>Run</button> |