Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
node-webkit window.isFocused emulation
(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