Reputation:
I have a chrome app. The app has a dialog in which the user can close the application.
Internally the chrome app now closes all its application windows and waits for chrome to shut the application down. After closing the windows chrome usually takes about 10 sec or so before it unloads
(aka: shuts down) the application and calls chrome.runtime.onSuspend
. Only then also the chrome://extensions/
dialog shows the application as (inactive)
.
This is documented in the chrome app lifecycle.
The problem is that sometimes a user restarts the application right away and if you do remove all objects yourself cleanly this could be an issues - one example: all chrome app instances of the same application share their memory.
Hence it would be nice if I could just close a chrome-app and not having to worry about cleaning up every last object etc.
Upvotes: 1
Views: 205
Reputation:
What you can do is actually closing the BackgroundPage
.
chrome.runtime.getBackgroundPage(function(background) {
background.close();
});
Besides closing the BackgroundPage
you also need to close all other application windows, but then the application gets flagged as inactive
right away.
Upvotes: 2