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