@@ -302,24 +302,38 @@ class Watchpack extends EventEmitter {
302302 return map ;
303303 }
304304
305+ getAggregated ( ) {
306+ if ( this . aggregateTimer ) {
307+ clearTimeout ( this . aggregateTimer ) ;
308+ this . aggregateTimer = undefined ;
309+ }
310+ const changes = this . aggregatedChanges ;
311+ const removals = this . aggregatedRemovals ;
312+ this . aggregatedChanges = new Set ( ) ;
313+ this . aggregatedRemovals = new Set ( ) ;
314+ return { changes, removals } ;
315+ }
316+
305317 _onChange ( item , mtime , file , type ) {
306318 file = file || item ;
307- if ( this . paused ) return ;
308- this . emit ( "change" , file , mtime , type ) ;
309- if ( this . aggregateTimer ) clearTimeout ( this . aggregateTimer ) ;
319+ if ( ! this . paused ) {
320+ this . emit ( "change" , file , mtime , type ) ;
321+ if ( this . aggregateTimer ) clearTimeout ( this . aggregateTimer ) ;
322+ this . aggregateTimer = setTimeout ( this . _onTimeout , this . aggregateTimeout ) ;
323+ }
310324 this . aggregatedRemovals . delete ( item ) ;
311325 this . aggregatedChanges . add ( item ) ;
312- this . aggregateTimer = setTimeout ( this . _onTimeout , this . aggregateTimeout ) ;
313326 }
314327
315328 _onRemove ( item , file , type ) {
316329 file = file || item ;
317- if ( this . paused ) return ;
318- this . emit ( "remove" , file , type ) ;
319- if ( this . aggregateTimer ) clearTimeout ( this . aggregateTimer ) ;
330+ if ( ! this . paused ) {
331+ this . emit ( "remove" , file , type ) ;
332+ if ( this . aggregateTimer ) clearTimeout ( this . aggregateTimer ) ;
333+ this . aggregateTimer = setTimeout ( this . _onTimeout , this . aggregateTimeout ) ;
334+ }
320335 this . aggregatedChanges . delete ( item ) ;
321336 this . aggregatedRemovals . add ( item ) ;
322- this . aggregateTimer = setTimeout ( this . _onTimeout , this . aggregateTimeout ) ;
323337 }
324338
325339 _onTimeout ( ) {
0 commit comments