asticode / go-astilectron

Build cross platform GUI apps with GO and HTML/JS/CSS (powered by Electron)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot listen event "app.cmd.quit"

hz-kelpie opened this issue · comments

mycode

OnWait: func(_ *astilectron.Astilectron, ws []*astilectron.Window, _ *astilectron.Menu, _ *astilectron.Tray, _ *astilectron.Menu) error {
			w = ws[0]
			w.OpenDevTools()
			w.On(astilectron.EventNameWindowEventMinimize, func(e astilectron.Event) (deleteListener bool) {
				l.Printf("click minimize")
				w.Hide()
				return false
			})

			w.On(astilectron.EventNameAppClose, func(e astilectron.Event) (deleteListener bool) {
				l.Printf("click app close")
				w.Hide()
				return false
			})

mylog

2023/10/19 11:02:09 Astilectron says: {"name":"window.event.minimize","targetID":"1"}
2023/10/19 11:02:09 click minimize
...
...
2023/10/19 11:02:12 Astilectron says: {"name":"app.cmd.quit","targetID":"app"}
2023/10/19 11:02:12 Stopping...
2023/10/19 11:02:12 astikit: stopping worker...
2023/10/19 11:02:12 'C:\Users\zhongqichao\AppData\Roaming\EDR LOGIN DEMO\vendor\electron-windows-amd64\electron.exe' exited with code: 1
2023/10/19 11:02:12 App has closed
2023/10/19 11:02:12 Closing...
2023/10/19 11:02:12 Stopping...
2023/10/19 11:02:12 accept tcp 127.0.0.1:60606: use of closed network connection while TCP accepting
2023/10/19 11:02:12 Stopping...

no print "click app close"

I want replace close -> hide

Can you try using the HideOnClose window attribute?