File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -82,6 +82,8 @@ Options:
8282 surrounded with quotes when command contains spaces
8383 -d, --debounce Debounce timeout in ms for executing command
8484 [default: 400]
85+ -t, --throttle Throttle timeout in ms for executing command
86+ [default: 0]
8587 -s, --follow-symlinks When not set, only the symlinks themselves will be
8688 watched for changes instead of following the link
8789 references and bubbling events through the links path
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ var EVENT_DESCRIPTIONS = {
1717
1818var defaultOpts = {
1919 debounce : 400 ,
20+ throttle : 0 ,
2021 followSymlinks : false ,
2122 ignore : null ,
2223 polling : false ,
@@ -55,6 +56,12 @@ var argv = require('yargs')
5556 describe : 'Debounce timeout in ms for executing command' ,
5657 type : 'number'
5758 } )
59+ . option ( 't' , {
60+ alias : 'throttle' ,
61+ default : defaultOpts . throttle ,
62+ describe : 'Throttle timeout in ms for executing command' ,
63+ type : 'number'
64+ } )
5865 . option ( 's' , {
5966 alias : 'follow-symlinks' ,
6067 default : defaultOpts . followSymlinks ,
@@ -131,7 +138,8 @@ function startWatching(opts) {
131138 var chokidarOpts = createChokidarOpts ( opts ) ;
132139 var watcher = chokidar . watch ( opts . patterns , chokidarOpts ) ;
133140
134- var debouncedRun = _ . debounce ( run , opts . debounce ) ;
141+ var throttledRun = _ . throttle ( run , opts . throttle ) ;
142+ var debouncedRun = _ . debounce ( throttledRun , opts . debounce ) ;
135143 watcher . on ( 'all' , function ( event , path ) {
136144 var description = EVENT_DESCRIPTIONS [ event ] + ':' ;
137145
You can’t perform that action at this time.
0 commit comments