File tree Expand file tree Collapse file tree 3 files changed +5
-14
lines changed
Expand file tree Collapse file tree 3 files changed +5
-14
lines changed Original file line number Diff line number Diff line change @@ -1135,8 +1135,7 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
11351135 }
11361136 }
11371137 ) ;
1138- } ,
1139- 10
1138+ }
11401139 ) ) ( this ) ;
11411140
11421141 rebuildModule ( m : Module , f : ( err : Error , m : Module ) => void ) {
Original file line number Diff line number Diff line change 11type CallFn < D > = ( args : D [ ] ) => void ;
22
33export default class MergeCaller < D > {
4- private timer : any = null ;
54 private callArgs : D [ ] = [ ] ;
65
7- // add in constructor
8- private debounceTime : number ;
96 private callFn : CallFn < D > ;
10- constructor ( fn : CallFn < D > , debounceTime : number ) {
11- this . debounceTime = debounceTime ;
7+ constructor ( fn : CallFn < D > ) {
128 this . callFn = fn ;
139 }
1410
1511 private finalCall = ( ) => {
16- this . timer = null ;
1712 const args = this . callArgs ;
1813 this . callArgs = [ ] ;
1914 this . callFn ( args ) ;
2015 } ;
2116
2217 push ( ...data : D [ ] ) {
23- if ( this . timer ) {
24- clearTimeout ( this . timer ) ;
18+ if ( this . callArgs . length === 0 ) {
19+ queueMicrotask ( this . finalCall ) ;
2520 }
26-
2721 this . callArgs . push ( ...data ) ;
28-
29- this . timer = setTimeout ( this . finalCall , this . debounceTime ) ;
3022 }
3123}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export function createFakeCompilationDependencies(
66 getDeps : ( ) => string [ ] ,
77 addDeps : ( deps : string [ ] ) => void
88) {
9- const addDepsCaller = new MergeCaller ( addDeps , 10 ) ;
9+ const addDepsCaller = new MergeCaller ( addDeps ) ;
1010 return {
1111 * [ Symbol . iterator ] ( ) {
1212 const deps = getDeps ( ) ;
You can’t perform that action at this time.
0 commit comments