event.Call("preventDefault") } first = false go func() { closec <- true }() }) w.Close() <-closec var closed = make(chan bool) w.OnClosed(func() { go func() { closed <- true }() }) w.Close() <-closec <-closed }) jasmine.AfterAllAsync(func(done func()) { time.AfterFunc(time.Millisecond*100, func() { w.Close() done() }) }) }) return true }()
done() }) w.GetWebContents().ExecuteJavaScript("location.href='file:///url2'", nil) }) jasmine.It("UserAgent", func() { var w = electron.NewBrowserWindow(nil) w.GetWebContents().SetUserAgent("user1") jasmine.Expect(w.GetWebContents().GetUserAgent()).ToBe("user1") w.Close() }) jasmine.It("OnCrashed", func() { var w = electron.NewBrowserWindow(&map[string]interface{}{ "webSecurity": false, }) var crashed = make(chan bool) w.GetWebContents().OnCrashed(func() { go func() { crashed <- true }() }) w.LoadURL("chrome://crash/", nil) <-crashed w.Close() }) jasmine.AfterAllAsync(func(done func()) { time.AfterFunc(time.Millisecond*10, done) }) }) return true }()