cannot listen event "app.cmd.quit"
hz-kelpie opened this issue · comments
hz-kelpie commented
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...
hz-kelpie commented
no print "click app close"
hz-kelpie commented
I want replace close -> hide
Quentin Renard commented
Can you try using the HideOnClose window attribute?