Comparing version 0.3.1 to 0.3.2
@@ -45,3 +45,4 @@ module.exports = function(grunt) { | ||
grunt.loadNpmTasks('grunt-contrib-nodeunit'); | ||
grunt.loadNpmTasks('grunt-contrib-watch'); | ||
grunt.registerTask('default', ['jshint', 'nodeunit']); | ||
}; |
@@ -149,6 +149,6 @@ /* | ||
_reset = _reset === false ? false : true; | ||
Object.keys(this._watchers).forEach(function(file) { | ||
Object.keys(_this._watchers).forEach(function(file) { | ||
_this._watchers[file].close(); | ||
}); | ||
this._watchers = Object.create(null); | ||
_this._watchers = Object.create(null); | ||
Object.keys(this._watched).forEach(function(dir) { | ||
@@ -161,7 +161,9 @@ fs.unwatchFile(dir); | ||
if (_reset) { | ||
this._watched = Object.create(null); | ||
this.removeAllListeners(); | ||
_this.emit('end'); | ||
_this._watched = Object.create(null); | ||
setTimeout(function() { | ||
_this.emit('end'); | ||
_this.removeAllListeners(); | ||
}, delay + 100); | ||
} | ||
return this; | ||
return _this; | ||
}; | ||
@@ -168,0 +170,0 @@ |
{ | ||
"name": "gaze", | ||
"description": "A globbing fs.watch wrapper built from the best parts of other fine watch libs.", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"homepage": "https://github.com/shama/gaze", | ||
@@ -37,6 +37,7 @@ "author": { | ||
"devDependencies": { | ||
"grunt-benchmark": "~0.1.1", | ||
"grunt": "~0.4.0rc3", | ||
"grunt": "~0.4.0rc4", | ||
"grunt-contrib-nodeunit": "~0.1.1", | ||
"grunt-contrib-jshint": "~0.1.0" | ||
"grunt-contrib-jshint": "~0.1.0", | ||
"grunt-contrib-watch": "~0.2.0", | ||
"grunt-benchmark": "~0.1.1" | ||
}, | ||
@@ -43,0 +44,0 @@ "keywords": [ |
@@ -154,2 +154,3 @@ # gaze [![Build Status](https://secure.travis-ci.org/shama/gaze.png?branch=master)](http://travis-ci.org/shama/gaze) | ||
## Release History | ||
* 0.3.2 - Emit `end` before removeAllListeners. | ||
* 0.3.1 - Fix added events within subfolder patterns. | ||
@@ -156,0 +157,0 @@ * 0.3.0 - Handle safewrite events, `forceWatchMethod` option removed, bug fixes and watch optimizations (@rgaskill). |
@@ -52,3 +52,2 @@ 'use strict'; | ||
watcher.close(); | ||
test.done(); | ||
}); | ||
@@ -58,2 +57,3 @@ this.on('added', function() { test.ok(false, 'added event should not have emitted.'); }); | ||
fs.writeFileSync(path.resolve(__dirname, 'fixtures', 'sub', 'one.js'), 'var one = true;'); | ||
watcher.on('end', test.done); | ||
}); | ||
@@ -68,3 +68,2 @@ }, | ||
watcher.close(); | ||
test.done(); | ||
}); | ||
@@ -74,2 +73,3 @@ this.on('changed', function() { test.ok(false, 'changed event should not have emitted.'); }); | ||
fs.writeFileSync(path.resolve(__dirname, 'fixtures', 'sub', 'tmp.js'), 'var tmp = true;'); | ||
watcher.on('end', test.done); | ||
}); | ||
@@ -83,3 +83,2 @@ }, | ||
watcher.close(); | ||
test.done(); | ||
}, 1000); | ||
@@ -91,2 +90,3 @@ this.on('added', function(filepath) { | ||
fs.writeFileSync(path.resolve(__dirname, 'fixtures', 'sub', 'tmp.js'), 'add me!'); | ||
watcher.on('end', test.done); | ||
}); | ||
@@ -102,3 +102,2 @@ }, | ||
watcher.close(); | ||
test.done(); | ||
}); | ||
@@ -108,2 +107,3 @@ this.on('changed', function() { test.ok(false, 'changed event should not have emitted.'); }); | ||
fs.unlinkSync(tmpfile); | ||
watcher.on('end', test.done); | ||
}); | ||
@@ -118,5 +118,5 @@ }, | ||
watcher.close(); | ||
test.done(); | ||
}); | ||
fs.writeFileSync(path.resolve(__dirname, 'fixtures', 'sub', 'one.js'), 'var one = true;'); | ||
watcher.on('end', test.done); | ||
}); | ||
@@ -133,11 +133,11 @@ }, | ||
setTimeout(function() { | ||
watcher.close(); | ||
test.done(); | ||
}, 5000); | ||
fs.readFileSync(path.resolve(__dirname, 'fixtures', 'sub', 'one.js')); | ||
}, 1000); | ||
// Give some time to accidentally emit before we close | ||
setTimeout(function() { watcher.close(); }, 5000); | ||
}); | ||
setTimeout(function() { | ||
fs.writeFileSync(path.resolve(__dirname, 'fixtures', 'sub', 'one.js'), 'var one = true;'); | ||
}, 1000); | ||
watcher.on('end', test.done); | ||
}); | ||
@@ -157,7 +157,9 @@ }, | ||
watcher.close(); | ||
test.done(); | ||
} | ||
}, 1000); | ||
}); | ||
fs.writeFileSync(path.resolve(__dirname, 'fixtures', 'sub', 'one.js'), 'var one = true;'); | ||
setTimeout(function() { | ||
fs.writeFileSync(path.resolve(__dirname, 'fixtures', 'sub', 'one.js'), 'var one = true;'); | ||
}, 1000); | ||
watcher.on('end', test.done); | ||
}); | ||
@@ -181,5 +183,5 @@ }, | ||
watcher.close(); | ||
test.done(); | ||
}); | ||
fs.writeFileSync(path.resolve(cwd, 'two.js'), 'var two = true;'); | ||
watcher.on('end', test.done); | ||
}); | ||
@@ -186,0 +188,0 @@ }, |
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
37472
926
171
5