Reputation: 37238
If a user was to restart the browser, via the restart methods (Shift + F2 > "restart" > enter) Or other methods, is it possible to listen for this and execute code before shutting down then starting up again?
I was thinking of registering obvserver for quit-application
and if data
parameter was retstart the execute some code, but my worry is, firefox is shutdown before code gets to execute, can someone please verify this thought of mine is false or true. and if true (it cant execute code) then can you please provide an alternative way which allows for code execution.
thanks
Upvotes: 0
Views: 32
Reputation: 16528
firefox is shutdown before code gets to execute, can someone please verify this thought of mine is false or true. and if true (it cant execute code) then can you please provide an alternative way which allows for code execution.
If your code is synchronous then it will block shutdown, if it's asynchronous then it may not finish.
The Application Shutdown observer notification list on MDN also provides more notifications you can use besides quit-application
in the order that they are called. You can see there are a couple that come before quit-application
.
Upvotes: 1