Hey a friend of me is askingif I could develop a plugin for him. But since I'm a Go developer I was wondering if it would be possible to create a wasm plugin.
But I didn't find a way, to load my wasm file within the PRG maker runtime.
In the golang wiki is written, that I need to include a JS file as a glue between the wasm file & JS:
Golang Wiki ->
https://github.com/golang/go/wiki/WebAssembly
Include JS file ->
wasm_exec.js
And to use the Golang functions from wasm it should be something like this:
const go = new Go();
WebAssembly.instantiateStreaming(fetch("main.wasm"), go.importObject).then((result) => {
go.run(result.instance);
});
When I add the
wasm_exec.js file as a plugin and a try to load the wasm file in other JS file it only works in the Browser.
But it doesn't matter what I tried to include the
wasm_exec.js file, it will always say that
Go is not defined.
Is there some tutorial how to do this?
Thanks for any help