Comparing version 0.1.2 to 0.1.3
@@ -267,14 +267,11 @@ /* | ||
var opts = Object.create(this.options); | ||
try { | ||
_this._watchers[file] = fs.watch(file, opts, function(event) { | ||
done(event, file); | ||
}); | ||
fs.watchFile(file, opts, function(curr, prev) { | ||
if (curr.mtime.getTime() !== prev.mtime.getTime()) { | ||
done(null, file); | ||
} | ||
}); | ||
} catch (err) { | ||
done(err); | ||
} | ||
var once = _.once(done); | ||
_this._watchers[file] = fs.watch(file, opts, function(event) { | ||
once(event, file); | ||
}); | ||
fs.watchFile(file, opts, function(curr, prev) { | ||
if (curr.mtime.getTime() !== prev.mtime.getTime()) { | ||
once(null, file); | ||
} | ||
}); | ||
return this; | ||
@@ -281,0 +278,0 @@ }; |
{ | ||
"name": "gaze", | ||
"description": "A globbing fs.watch wrapper built from the best parts of other fine watch libs.", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"homepage": "https://github.com/shama/gaze", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -141,2 +141,3 @@ # gaze [![Build Status](https://secure.travis-ci.org/shama/gaze.png?branch=master)](http://travis-ci.org/shama/gaze) | ||
## Release History | ||
* 0.1.3 - Fix race condition with 2 watches | ||
* 0.1.2 - Read triggering changed event fix | ||
@@ -143,0 +144,0 @@ * 0.1.1 - Minor fixes |
@@ -109,3 +109,19 @@ 'use strict'; | ||
}); | ||
}, | ||
dontEmitTwice: function(test) { | ||
test.expect(2); | ||
gaze('**/*', function(err, watcher) { | ||
watcher.on('all', function(status, filepath) { | ||
var expected = path.relative(process.cwd(), filepath); | ||
test.equal(path.join('sub', 'one.js'), expected); | ||
test.equal(status, 'changed'); | ||
fs.readFileSync(path.resolve(__dirname, 'fixtures', 'sub', 'one.js')); | ||
setTimeout(function() { | ||
watcher.close(); | ||
test.done(); | ||
}, 5000); | ||
}); | ||
fs.writeFileSync(path.resolve(__dirname, 'fixtures', 'sub', 'one.js'), 'var one = true;'); | ||
}); | ||
} | ||
}; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
24849
590
149
0