Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 
 
 

29 righe
858 B

  1. 'use strict';
  2. var NodeWatcher = require('./src/node_watcher');
  3. var PollWatcher = require('./src/poll_watcher');
  4. var WatchmanWatcher = require('./src/watchman_watcher');
  5. var FSEventsWatcher = require('./src/fsevents_watcher');
  6. function sane(dir, options) {
  7. options = options || {};
  8. if (options.watcher) {
  9. var WatcherClass = require(options.watcher);
  10. return new WatcherClass(dir, options);
  11. } else if (options.poll) {
  12. return new PollWatcher(dir, options);
  13. } else if (options.watchman) {
  14. return new WatchmanWatcher(dir, options);
  15. } else if (options.fsevents) {
  16. return new FSEventsWatcher(dir, options);
  17. } else {
  18. return new NodeWatcher(dir, options);
  19. }
  20. }
  21. module.exports = sane;
  22. sane.NodeWatcher = NodeWatcher;
  23. sane.PollWatcher = PollWatcher;
  24. sane.WatchmanWatcher = WatchmanWatcher;
  25. sane.FSEventsWatcher = FSEventsWatcher;