mirror of
https://github.com/kataras/iris.git
synced 2025-12-19 10:57:05 +00:00
Iris + WebAssemply = = 💓
Former-commit-id: 44f08f112cfba8006d2a6fe34e32b24e5c246856
This commit is contained in:
13
_examples/webassembly/basic/client/main.js
Normal file
13
_examples/webassembly/basic/client/main.js
Normal file
@@ -0,0 +1,13 @@
|
||||
import './go-wasm-runtime.js';
|
||||
|
||||
if (!WebAssembly.instantiateStreaming) { // polyfill
|
||||
WebAssembly.instantiateStreaming = async (resp, importObject) => {
|
||||
const source = await (await resp).arrayBuffer();
|
||||
return await WebAssembly.instantiate(source, importObject);
|
||||
};
|
||||
}
|
||||
|
||||
const go = new Go();
|
||||
WebAssembly.instantiateStreaming(fetch("hello.wasm"), go.importObject).then((result) => {
|
||||
return WebAssembly.instantiate(result.module, go.importObject);
|
||||
}).then(instance => go.run(instance));
|
||||
Reference in New Issue
Block a user