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
1135
1135
}
1136
1136
}
1137
1137
) ;
1138
- } ,
1139
- 10
1138
+ }
1140
1139
) ) ( this ) ;
1141
1140
1142
1141
rebuildModule ( m : Module , f : ( err : Error , m : Module ) => void ) {
Original file line number Diff line number Diff line change 1
1
type CallFn < D > = ( args : D [ ] ) => void ;
2
2
3
3
export default class MergeCaller < D > {
4
- private timer : any = null ;
5
4
private callArgs : D [ ] = [ ] ;
6
5
7
- // add in constructor
8
- private debounceTime : number ;
9
6
private callFn : CallFn < D > ;
10
- constructor ( fn : CallFn < D > , debounceTime : number ) {
11
- this . debounceTime = debounceTime ;
7
+ constructor ( fn : CallFn < D > ) {
12
8
this . callFn = fn ;
13
9
}
14
10
15
11
private finalCall = ( ) => {
16
- this . timer = null ;
17
12
const args = this . callArgs ;
18
13
this . callArgs = [ ] ;
19
14
this . callFn ( args ) ;
20
15
} ;
21
16
22
17
push ( ...data : D [ ] ) {
23
- if ( this . timer ) {
24
- clearTimeout ( this . timer ) ;
18
+ if ( this . callArgs . length === 0 ) {
19
+ queueMicrotask ( this . finalCall ) ;
25
20
}
26
-
27
21
this . callArgs . push ( ...data ) ;
28
-
29
- this . timer = setTimeout ( this . finalCall , this . debounceTime ) ;
30
22
}
31
23
}
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ export function createFakeCompilationDependencies(
6
6
getDeps : ( ) => string [ ] ,
7
7
addDeps : ( deps : string [ ] ) => void
8
8
) {
9
- const addDepsCaller = new MergeCaller ( addDeps , 10 ) ;
9
+ const addDepsCaller = new MergeCaller ( addDeps ) ;
10
10
return {
11
11
* [ Symbol . iterator ] ( ) {
12
12
const deps = getDeps ( ) ;
You can’t perform that action at this time.
0 commit comments