Sha256: fef4655f2a32b24dca88b376b47968d33d393430d82922b6c24727f65867218f

Contents?: true

Size: 597 Bytes

Versions: 7

Compression:

Stored size: 597 Bytes

Contents

var fs = require('fs')
  , watch = require('../main')
  , assert = require('assert')
  ;

//
// Demonstrate that the function of 'filter' is semantically inconsistent with
// usual convention, that returning true means 'keep this'.
//
function isDirOrQ(f, stat) { return stat.isDirectory() || f === 'Q'; }

watch.watchTree(__dirname, { filter: isDirOrQ }, function (f, curr, prev) {
  if (typeof f == 'object' && prev === null && curr === null) {
    Object.keys(f).forEach(function(name) {
      var stat = f[name];
      assert(isDirOrQ(name, stat));
      fs.unwatchFile(name);
    });
  }
});

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
lanes-0.8.0 node_modules/watch/test/test_watchTree.js
batman-rails-flo-0.1.0 vendor/assets/javascripts/batman/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_watchTree.js
batman-rails-flo-0.0.5 vendor/assets/javascripts/batman/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_watchTree.js
batman-rails-flo-0.0.4 vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_watchTree.js
batman-rails-flo-0.0.3 vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_watchTree.js
batman-rails-flo-0.0.2 vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_watchTree.js
batman-rails-flo-0.0.1 vendor/assets/javascripts/batman_rails_flo/node_modules/fb-flo/node_modules/sane/node_modules/watch/test/test_watchTree.js