File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 66 SafeMap,
77 SafeSet,
88 StringPrototypeStartsWith,
9+ Symbol,
910} = primordials ;
1011
1112const { validateNumber, validateOneOf } = require ( 'internal/validators' ) ;
@@ -21,6 +22,7 @@ const { setTimeout } = require('timers');
2122const supportsRecursiveWatching = process . platform === 'win32' ||
2223 process . platform === 'darwin' ;
2324
25+ const kGlobalDebounce = Symbol ( 'kGlobalDebounce' ) ;
2426class FilesWatcher extends EventEmitter {
2527 #watchers = new SafeMap ( ) ;
2628 #filteredFiles = new SafeSet ( ) ;
@@ -74,16 +76,17 @@ class FilesWatcher extends EventEmitter {
7476 }
7577
7678 #onChange( trigger ) {
77- if ( this . #debouncing. has ( trigger ) ) {
79+ if ( this . #debouncing. has ( trigger ) || this . #debouncing . has ( kGlobalDebounce ) ) {
7880 return ;
7981 }
8082 if ( this . #mode === 'filter' && ! this . #filteredFiles. has ( trigger ) ) {
8183 return ;
8284 }
83- this . #debouncing. add ( trigger ) ;
85+ this . #debouncing. add ( trigger ) . add ( kGlobalDebounce ) ;
8486 const owners = this . #depencencyOwners. get ( trigger ) ;
8587 setTimeout ( ( ) => {
8688 this . #debouncing. delete ( trigger ) ;
89+ this . #debouncing. delete ( kGlobalDebounce ) ;
8790 this . emit ( 'changed' , { owners } ) ;
8891 } , this . #debounce) . unref ( ) ;
8992 }
You can’t perform that action at this time.
0 commit comments