Skip to content

Instantly share code, notes, and snippets.

@tuefekci
Forked from b1rdex/is-focused.js
Created April 3, 2014 06:57
Show Gist options
  • Save tuefekci/9949500 to your computer and use it in GitHub Desktop.
Save tuefekci/9949500 to your computer and use it in GitHub Desktop.
(function() {
window.frame = require("nw.gui").Window.get();
window.frame.isFocused = true;
var windowFocusHandler = function() {
window.frame.isFocused = true;
}
, windowBlurHandler = function() {
window.frame.isFocused = false;
}
;
window.frame.on("focus", windowFocusHandler);
window.frame.on("blur", windowBlurHandler);
window.addEventListener("focus", windowFocusHandler);
window.addEventListener("blur", windowBlurHandler);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment