I took out the Funcs for now, but no difference.  But good point about the 
signal! I currently dont have an exit button, Although I figure most people 
just close a tab, or close the browser, so I guess I need to find a way to 
make that work without an explicit button...? or maybe they just hit 
refresh like I have been doing :)  I dont know enough about the browser 
environment to know if the wasm blob itself will just get released without 
the chan exit, but I would imagine it would?

Anyway here is my code:

https://github.com/WhiteHexagon/go2wasm-vr/blob/master/main.go

Even with Funcs I wouldn't expect an OOM or mostly I just get nothing at 
all from simply hitting refresh on the page.  I must be missing something 
obvious here.  (It's still working fine on my mac).

btw I found some mention of tools for wasm shrinking today, but not been 
able to try them yet.

https://rustwasm.github.io/book/game-of-life/code-size.html
https://rustwasm.github.io/book/reference/code-size.html

The most interesting one goes from wasm-to-wasm and is called 'wasm-opt':

https://github.com/WebAssembly/binaryen

Has anyone tried this yet?  It sounds quite impressive.

Thanks for your help, Peter


> Are you signalling the chan to exit ? Unless that happens, those Funcs 
> will not be released. Typically, you have an "exit" button which is hooked 
> to an event listener that signals your main goroutine to exit, cleaning up 
> its resources.
>
> Regarding restart, just use JS to call go.run() again, once you have 
> exited from it. Reuse the result.instance by storing it in a variable. I 
> think that should do it. 
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to