11
11
import {
12
12
enableSchedulerDebugging ,
13
13
enableProfiling ,
14
+ enableIsInputPending ,
15
+ enableIsInputPendingContinuous ,
16
+ schedulerYieldMs ,
14
17
} from '../SchedulerFeatureFlags' ;
15
18
16
19
import { push , pop , peek } from '../SchedulerMinHeap' ;
@@ -36,8 +39,6 @@ import {
36
39
startLoggingProfilingEvents ,
37
40
} from '../SchedulerProfiling' ;
38
41
39
- import { enableIsInputPending } from '../SchedulerFeatureFlags' ;
40
-
41
42
let getCurrentTime ;
42
43
const hasPerformanceNow =
43
44
typeof performance === 'object' && typeof performance . now === 'function' ;
@@ -418,7 +419,7 @@ let taskTimeoutID = -1;
418
419
// thread, like user events. By default, it yields multiple times per frame.
419
420
// It does not attempt to align with frame boundaries, since most tasks don't
420
421
// need to be frame aligned; for those that do, use requestAnimationFrame.
421
- let yieldInterval = 5 ;
422
+ let yieldInterval = schedulerYieldMs ;
422
423
let deadline = 0 ;
423
424
424
425
// TODO: Make this configurable
@@ -444,7 +445,12 @@ function shouldYieldToHost() {
444
445
// regardless, since there could be a pending paint that wasn't
445
446
// accompanied by a call to `requestPaint`, or other main thread tasks
446
447
// like network events.
447
- if ( needsPaint || scheduling . isInputPending ( ) ) {
448
+ if (
449
+ needsPaint ||
450
+ scheduling . isInputPending ( {
451
+ includeContinuous : enableIsInputPendingContinuous ,
452
+ } )
453
+ ) {
448
454
// There is either a pending paint or a pending input.
449
455
return true ;
450
456
}
@@ -489,7 +495,7 @@ function forceFrameRate(fps) {
489
495
yieldInterval = Math . floor ( 1000 / fps ) ;
490
496
} else {
491
497
// reset the framerate
492
- yieldInterval = 5 ;
498
+ yieldInterval = schedulerYieldMs ;
493
499
}
494
500
}
495
501
0 commit comments