Notifio is a desktop app that checks your rental searches every 30 seconds and emails you when a new listing appears. The entire value of it is that it is running when you are not looking, so the most product-critical code in the app is not the monitor. It is the handful of lifecycle hooks that decide what "closed" means.
There are five of them and they do not agree with each other on purpose.
Hook one: the close button does not close
mainWindow . on ( ' close ' , ( event ) => { if ( ! ( app as any ). isQuitting ) { event . preventDefault (); mainWindow ?. hide (); } });
Enter fullscreen mode
Exit fullscreen mode
Pressing the red button or Alt+F4 hides the window and leaves the process running. The flag is the only thing that distinguishes a real quit from a close, and it is set in exactly two places: the tray's Quit item, and before-quit .
That (app as any) cast is not something I am proud of.…