1111import {
1212 enableSchedulerDebugging ,
1313 enableProfiling ,
14+ enableIsInputPending ,
15+ enableIsInputPendingContinuous ,
16+ schedulerYieldMs ,
1417} from '../SchedulerFeatureFlags' ;
1518
1619import { push , pop , peek } from '../SchedulerMinHeap' ;
@@ -36,8 +39,6 @@ import {
3639 startLoggingProfilingEvents ,
3740} from '../SchedulerProfiling' ;
3841
39- import { enableIsInputPending } from '../SchedulerFeatureFlags' ;
40-
4142let getCurrentTime ;
4243const hasPerformanceNow =
4344 typeof performance === 'object' && typeof performance . now === 'function' ;
@@ -418,7 +419,7 @@ let taskTimeoutID = -1;
418419// thread, like user events. By default, it yields multiple times per frame.
419420// It does not attempt to align with frame boundaries, since most tasks don't
420421// need to be frame aligned; for those that do, use requestAnimationFrame.
421- let yieldInterval = 5 ;
422+ let yieldInterval = schedulerYieldMs ;
422423let deadline = 0 ;
423424
424425// TODO: Make this configurable
@@ -444,7 +445,12 @@ function shouldYieldToHost() {
444445 // regardless, since there could be a pending paint that wasn't
445446 // accompanied by a call to `requestPaint`, or other main thread tasks
446447 // like network events.
447- if ( needsPaint || scheduling . isInputPending ( ) ) {
448+ if (
449+ needsPaint ||
450+ scheduling . isInputPending ( {
451+ includeContinuous : enableIsInputPendingContinuous ,
452+ } )
453+ ) {
448454 // There is either a pending paint or a pending input.
449455 return true ;
450456 }
@@ -489,7 +495,7 @@ function forceFrameRate(fps) {
489495 yieldInterval = Math . floor ( 1000 / fps ) ;
490496 } else {
491497 // reset the framerate
492- yieldInterval = 5 ;
498+ yieldInterval = schedulerYieldMs ;
493499 }
494500}
495501
0 commit comments