Reputation: 2229
Is there any way to handle Chrome packaged appWindow active/inactive state?
The events something like this onActive
or onFocus
.
Upvotes: 3
Views: 76
Reputation: 1892
The AppWindow does not provide this, but the standard DOM window does via window.onfocus and window.onblur.
e.g:
function windowLostFocus() {
stopPlayingMusic();
}
window.onblur = windowLostFocus;
Upvotes: 3
Reputation: 1887
There currently isn't, but there is an API being added right now that will do something close to what you need. Until it's landed, we can't be 100% sure about the final shape, but you will get something along the lines of:
chrome.app.window.isVisible
chrome.app.window.onShown
chrome.app.window.onHidden
...etc.
You can follow the progress in this discussion thread at apps-dev group:
https://groups.google.com/a/chromium.org/forum/#!topic/apps-dev/EZYnJeKI6zw
Upvotes: 0