I have a database running alongside my electron app and when the app closes I need to save some data and shutdown the database.
I thought “onbeforeunload” would do the trick but I forgot that in this case I only have the global scope available in the function bound to the event. Of course I could attach everything I need to the global scope which I’d like to avoid for obvious reasons.
Is there a “properer” way of accomplishing this with electron?