Creating an electron app for Mac OSX.
I don't want to close the app when I press the close button, but like other Mac apps, I want to hide the window, but I don't know how to do it.
Even if you press the close button, if you exit the application from Menu Quit, or if you shut down the OS and force the application to exit, all browser-window close events are called, so you cannot determine whether the application is closed or hidden.
Is there a way to determine why the close event occurred?electron
By default, when you press the close button, the browserWindow quit event is called, but the app quit event does not occur.
App-side quit events are called when the app ends, such as Cmd+Q.
Electron app events are officially well written.
If the questioner receives everything he wants to do as if he doesn't want to close the app itself even if he closes the window, that's the default.If not, please review your code.You should have shut down the app when you closed the window.
If you want to display the window again when you click Dock, like other apps, why don't you get the event when the electron is activated and generate the window again?
If you don't want the state to return to its initial state, you can save the state of the app when you close it (you can get the event when you close it) and write a code that restores the state when you regenerate the window.
© 2022 OneMinuteCode. All rights reserved.