Are there event listeners for the chrome-packed application to find out if the application has lost focus? I'm trying to make a game, but I can't get it to pause when I change focus.
I tried several different things, such as the following, but no one works.
document.onblur = pause; document.addEventListener('blur', pause, false); canvas.onblur = pause; canvas.addEventListener('blur', pause, false); window.onblur = pause; window.addEventListener('blur', pause, false); chrome.app.window.onblur = pause; chrome.app.window.onBlur = pause; chrome.app.window.onblurred = pause; chrome.app.window.onBlurred = pause; chrome.app.window.addEventListener('blur', pause, false); chrome.app.window.current().onblur = pause; chrome.app.window.current().onBlur = pause; chrome.app.window.current().onblurred = pause; chrome.app.window.current().onBlurred = pause; chrome.app.window.current().addEventListener('blur', pause, false);
Any ideas? I can literally copy this entire list into my code, and not one pauses.
I am lost and Google has 3 results with some unrelated things, and then with missed work that I consider important.
source share