Skip to content

Instantly share code, notes, and snippets.

@goofmint
Created December 8, 2018 06:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save goofmint/50a05f961ed33a44ef4c5685182d2150 to your computer and use it in GitHub Desktop.
Save goofmint/50a05f961ed33a44ef4c5685182d2150 to your computer and use it in GitHub Desktop.
package main
import "syscall/js"
func main() {
document := js.Global().Get("document")
button := document.Call("getElementById", "btn")
cb1 := js.NewCallback(func(args []js.Value) {
println("Clicked");
})
button.Call("addEventListener", "click", cb1)
<-make(chan struct{}, 0)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment