File tree 2 files changed +11
-0
lines changed
2 files changed +11
-0
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,7 @@ type DevOptions = {
115
115
clear : boolean
116
116
cls : boolean
117
117
'ignore-watch' : string
118
+ debounce : string
118
119
'all-deps' : boolean
119
120
'deps-level' : string
120
121
'compile-timeout' : string
Original file line number Diff line number Diff line change @@ -228,7 +228,17 @@ export const runDev = (
228
228
}
229
229
}
230
230
231
+ let debounceTimeout : ReturnType < typeof setTimeout >
232
+ const defaultDebounce : string = ( opts . debounce === '' ) ? '1000' : opts . debounce
233
+ const debounceTime : number = parseInt ( defaultDebounce , 10 ) || 0
231
234
function restart ( file : string , isManualRestart ?: boolean ) {
235
+ clearTimeout ( debounceTimeout )
236
+ debounceTimeout = setTimeout ( ( ) => {
237
+ restartAfterDebounce ( file , isManualRestart )
238
+ } , debounceTime )
239
+ }
240
+
241
+ function restartAfterDebounce ( file : string , isManualRestart ?: boolean ) {
232
242
if ( file === compiler . tsConfigPath ) {
233
243
notify ( 'Reinitializing TS compilation' , '' )
234
244
compiler . init ( )
You can’t perform that action at this time.
0 commit comments