lib/watcher.js
function SwaggerWatcher(server) {
  var self = this;
  self.server = server;

  /**
   * The Swagger API files that are being watched.
   * @type {FSWatcher[]}
   */
  self.watchedSwaggerFiles = [];

  /**
   * The Handler files that are being watched.
   * @type {FSWatcher[]}
   */
  self.watchedHandlerFiles = [];

  // Watch Swagger API files
  server.on('parsed', function(err, api, parser) {
    // Watch all the files that were parsed
    self.unwatchSwaggerFiles();
    self.watchSwaggerFiles(parser.$refs.paths('fs'));
  });

  // Watch Handler Files
  server.on('handled', function(err, filePaths) {
    self.unwatchHandlerFiles(filePaths);
    self.watchHandlerFiles(filePaths);
  });
}
function SwaggerWatcher(server) {
  var self = this;
  self.server = server;

  /**
   * The Swagger API files that are being watched.
   * @type {FSWatcher[]}
   */
  self.watchedSwaggerFiles = [];

  /**
   * The Handler files that are being watched.
   * @type {FSWatcher[]}
   */
  self.watchedHandlerFiles = [];

  // Watch Swagger API files
  server.on('parsed', function(err, api, parser) {
    // Watch all the files that were parsed
    self.unwatchSwaggerFiles();
    self.watchSwaggerFiles(parser.$refs.paths('fs'));
  });

  // Watch Handler Files
  server.on('handled', function(err, filePaths) {
    self.unwatchHandlerFiles(filePaths);
    self.watchHandlerFiles(filePaths);
  });
}
function SwaggerWatcher ( server ) { var self = this ; self . server = server ; /**
   * The Swagger API files that are being watched.
   * @type {FSWatcher[]}
   */ self . watchedSwaggerFiles = [ ] ; /**
   * The Handler files that are being watched.
   * @type {FSWatcher[]}
   */ self . watchedHandlerFiles = [ ] ; // Watch Swagger API files server . on ( 'parsed' , function ( err , api , parser ) { // Watch all the files that were parsed self . unwatchSwaggerFiles ( ) ; self . watchSwaggerFiles ( parser . $refs . paths ( 'fs' ) ) ; } ) ; // Watch Handler Files server . on ( 'handled' , function ( err , filePaths ) { self . unwatchHandlerFiles ( filePaths ) ; self . watchHandlerFiles ( filePaths ) ; } ) ; }
Watches files for changes and updates the server accordingly.

@param {SwaggerServer} server
@constructor
Watches files for changes and updates the server accordingly .