4 ms·
Does it handle defining functions? I can’t get them to work.
by joeblubaugh 4y ago
Does it handle defining functions? I can’t get them to work.
- ricardbejarano 4y agoI'm afraid it cannot, since those functions would need to be compiled into WASM first, and that's something the browser can't do. What I could add, though, is a bunch of "standard" functions (like the ones found in Hugo, for example). Noted!
- eatonphil 4y agoIf you already have Go libraries compiling to wasm working then you could just embed a Go interpreter like yaegi [0]. [0] https://github.com/traefik/yaegi https://github.com/traefik/yaegi
- pjmlp 4y agoBesides the comment regarding using a Go interpreter, you can definitely compile inside of the browser and then load that WASM module into the current session.
- isaacimagine 4y agoUsing which compiler?
- pjmlp 4y agoTime to learn how to write one? I didn't say there is already a Go compiler that supports such workflow, rather that the infrastructure doesn't forbid it.
- ridruejo 4y agohttps://www.google.com/amp/s/golangexample.com/go-compiler-running-entirely-in-your-browser/amp/ https://www.google.com/amp/s/golangexample.com/go-compiler-r... Haven’t tried the above, just an example. Tinygo is the one commonly used in the Wasm ecosystem