In Go’s JavaScript integration, js.Global() returns the global JavaScript object. Calling Set on it exposes a Go function everywhere on the page, allowing JavaScript handlers such as generate() to invoke Go code. section 12.2.2
Global exposure is convenient for a small application, but larger applications can avoid namespace pollution by placing functions on a dedicated JavaScript object. section 12.2.2
Registering a Go function globally
js.Global().Set("generate", js.FuncOf(m.generate)) JavaScript can then call generate(), for example from a button’s onclick handler. A namespaced alternative registers the function as multiplyApp.generate().

