test_monitorRootDirectory.js 845 B

12345678910111213141516171819202122232425262728
  1. var fs, watch, watch_original;
  2. watch = require('../main');
  3. watch_original = require('watch');
  4. fs = require('fs');
  5. watch.createMonitor(__dirname, function (monitor) {
  6. monitor.on("created", function (f, stat) {
  7. console.log(f + " created");
  8. });
  9. monitor.on("changed", function (f, curr, prev) {
  10. console.log(f + " changed");
  11. });
  12. monitor.on("removed", function (f, stat) {
  13. console.log(f + " removed");
  14. });
  15. });
  16. watch_original.createMonitor(__dirname, function (monitor) {
  17. monitor.on("created", function (f, stat) {
  18. console.log("ORIGINAL: " + f + " created");
  19. });
  20. monitor.on("changed", function (f, curr, prev) {
  21. console.log("ORIGINAL: " + f + " changed");
  22. });
  23. monitor.on("removed", function (f, stat) {
  24. console.log("ORIGINAL: " + f + " removed");
  25. });
  26. });