Skip to content

Instantly share code, notes, and snippets.

@bbuecherl
Last active August 29, 2015 14:12
Show Gist options
  • Save bbuecherl/f35a298ede6efebb86c4 to your computer and use it in GitHub Desktop.
Save bbuecherl/f35a298ede6efebb86c4 to your computer and use it in GitHub Desktop.
11 LOC lifereload for node-webkit
var chokidar = require("chokidar"),
win = require("nw.gui").Window.get(),
watcher = chokidar.watch(process.cwd(), { persistent: true }),
reloader = function() {
win.reload();
};
watcher.on("ready", function() {
watcher.on("add", reloader)
.on("addDir", reloader)
.on("change", reloader);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment