Why should we use even visibility change API? The window focus and blur event listeners works good. And even without knockout.js . Please take a look:
var checkFocus = function() { console.log(document.hasFocus()); } checkFocus(); // init
window.addEventListener("focus", checkFocus); window.addEventListener("blur", checkFocus);
Why should we use even visibility change API? The window focus and blur event listeners works good. And even without knockout.js . Please take a look:
var checkFocus = function() {
console.log(document.hasFocus());
}
checkFocus(); // init
window.addEventListener("focus", checkFocus);
window.addEventListener("blur", checkFocus);