Skip to content

Instantly share code, notes, and snippets.



Created Dec 12, 2018
What would you like to do?
func main() {
window := js.Global().Get("window")
navigator := js.Global().Get("navigator")
cb1 := js.NewCallback(func(args []js.Value) {
if navigator.Get("onLine").Bool() {
println("Network is Online");
} else {
println("Network is Offline");
window.Call("addEventListener", "online", cb1)
window.Call("addEventListener", "offline", cb1)
<-make(chan struct{}, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment