Skip to content

Commit 21f08e3

Browse files
committed
Breaking: Remove lodash.debounce & no longer utilize extra debounce options (closes #31)
1 parent dc1025f commit 21f08e3

File tree

4 files changed

+4
-31
lines changed

4 files changed

+4
-31
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Default: `[ 'add', 'change', 'unlink' ]`
106106

107107
##### other
108108

109-
Options are passed directly to [lodash.debounce][lodash-debounce] and [chokidar][chokidar], so all their options are supported. Any debounce-related options are documented in [lodash.debounce][lodash-debounce]. Any chokidar-related options are documented in [chokidar][chokidar].
109+
Options are passed directly to [chokidar][chokidar].
110110

111111
## License
112112

@@ -131,4 +131,3 @@ MIT
131131
[node-glob]: https://github.com/isaacs/node-glob
132132
[async-completion]: https://github.com/gulpjs/async-done#completion-and-error-resolution
133133
[chokidar]: https://github.com/paulmillr/chokidar
134-
[lodash-debounce]: https://lodash.com/docs#debounce

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

33
var chokidar = require('chokidar');
4-
var debounce = require('lodash.debounce');
4+
var debounce = require('just-debounce');
55
var asyncDone = require('async-done');
66
var defaults = require('object.defaults');
77

@@ -57,7 +57,7 @@ function watch(glob, options, cb) {
5757

5858
var fn;
5959
if (typeof cb === 'function') {
60-
fn = debounce(onChange, opt.delay, opt);
60+
fn = debounce(onChange, opt.delay);
6161
}
6262

6363
function watchEvent(eventName) {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"dependencies": {
2424
"async-done": "^1.2.0",
2525
"chokidar": "^1.4.3",
26-
"lodash.debounce": "^4.0.6",
26+
"just-debounce": "^1.0.0",
2727
"object.defaults": "^1.0.0"
2828
},
2929
"devDependencies": {

test/index.js

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -216,32 +216,6 @@ describe('glob-watcher', function() {
216216
});
217217
});
218218

219-
it('passes options to lodash.debounce', function(done) {
220-
var runs = 0;
221-
222-
watcher = watch(outGlob, { leading: true }, function(cb) {
223-
runs++;
224-
if (runs === 1) {
225-
setTimeout(function() {
226-
expect(runs).toEqual(1);
227-
cb();
228-
}, timeout * 3);
229-
}
230-
if (runs === 2) {
231-
expect(runs).toEqual(2);
232-
cb();
233-
done();
234-
}
235-
});
236-
237-
// We default `ignoreInitial` to true, so always wait for `on('ready')`
238-
watcher.on('ready', function() {
239-
changeFile();
240-
// Fires on the leading edge on the debounce
241-
setTimeout(changeFile, timeout);
242-
});
243-
});
244-
245219
it('does not override default values with null values', function(done) {
246220
watcher = watch(outGlob, { ignoreInitial: null }, function(cb) {
247221
cb();

0 commit comments

Comments
 (0)