关机前监听重启并执行代码
Listen to restart and execute code before shutting down
如果用户要重启浏览器,通过重启方法(Shift + F2 > "restart" > enter)或其他方法,是否可以在关闭之前监听并执行代码然后启动又起来了?
我正在考虑为 quit-application
注册 obvserver,如果 data
参数被重新启动执行一些代码,但我担心的是,firefox 在代码开始执行之前就关闭了,有人可以验证一下吗我的这个想法是假的还是真的。如果为真(它无法执行代码),那么您能否提供一种允许代码执行的替代方法。
谢谢
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.
如果您的代码是同步的,那么它将阻止关闭,如果它是异步的,那么它可能无法完成。
The Application Shutdown observer notification list on MDN 还提供了除 quit-application
之外的更多通知,您可以按调用顺序使用这些通知。您可以看到 quit-application
.
之前有一对
如果用户要重启浏览器,通过重启方法(Shift + F2 > "restart" > enter)或其他方法,是否可以在关闭之前监听并执行代码然后启动又起来了?
我正在考虑为 quit-application
注册 obvserver,如果 data
参数被重新启动执行一些代码,但我担心的是,firefox 在代码开始执行之前就关闭了,有人可以验证一下吗我的这个想法是假的还是真的。如果为真(它无法执行代码),那么您能否提供一种允许代码执行的替代方法。
谢谢
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.
如果您的代码是同步的,那么它将阻止关闭,如果它是异步的,那么它可能无法完成。
The Application Shutdown observer notification list on MDN 还提供了除 quit-application
之外的更多通知,您可以按调用顺序使用这些通知。您可以看到 quit-application
.