Close event for chrome.app.window

你。 提交于 2019-11-27 05:45:58

问题


When a chrome app window is closed, is it possible to detect the event? and do an action before the window is closed?


回答1:


chrome.app.window.current().onClosed allows you to register an event listener for when a window is closed.




回答2:


Vincent's answer will work in some cases, but the documentation warns that some chrome api functionality will be lost by the time the onClosed event is fired.

Note, this should be listened to from a window other than the window being closed, for example from the background page

To listen for this event from the background page, do something like this:

chrome.app.window.get(windowIDUsedToCreateChildWindow).onClosed.addListener(function(){...})


来源:https://stackoverflow.com/questions/15662127/close-event-for-chrome-app-window

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!