123456789101112131415161718192021222324252627282930 |
- // var watch = require('watch');
- // watch.watchTree("../unity2laya", (f, curr, prev) => {
- // if (typeof f == "object" && prev === null && curr === null) {
- // console.log("Finished walking the tree");
- // } else if (prev === null) {
- // console.log("f is a new file");
- // } else if (curr.nlink === 0) {
- // // f was removed
- // console.log("f was removed");
- // } else {
- // console.log("f was changed");
- // }
- // })
- var watch = require('watch');
- watch.createMonitor('../unity2laya', function (monitor) {
- // monitor.files['/home/mikeal/.zshrc'] // Stat object for my zshrc.
- monitor.on("created", function (f, stat) {
- // Handle new files
- console.log("Handle new files");
- })
- monitor.on("changed", function (f, curr, prev) {
- // Handle file changes
- console.log(f,curr,prev);
- })
- monitor.on("removed", function (f, stat) {
- console.log("Handle removed files");
- // Handle removed files
- })
- //monitor.stop(); // Stop watching
- });
|