MCPcopy
hub / github.com/facebook/react / shouldYieldToHost

Function shouldYieldToHost

packages/scheduler/src/forks/Scheduler.js:447–460  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

445let startTime = -1;
446
447function shouldYieldToHost(): boolean {
448 if (!enableAlwaysYieldScheduler && enableRequestPaint && needsPaint) {
449 // Yield now.
450 return true;
451 }
452 const timeElapsed = getCurrentTime() - startTime;
453 if (timeElapsed < frameInterval) {
454 // The main thread has only been blocked for a really short amount of time;
455 // smaller than a single frame. Don't yield yet.
456 return false;
457 }
458 // Yield now.
459 return true;
460}
461
462function requestPaint() {
463 if (enableRequestPaint) {

Callers 1

workLoopFunction · 0.70

Calls 1

getCurrentTimeFunction · 0.70

Tested by

no test coverage detected