MCPcopy Index your code
hub / github.com/react/react / unstable_flushNumberOfYields

Function unstable_flushNumberOfYields

packages/scheduler/src/forks/SchedulerMock.js:488–510  ·  view source on GitHub ↗
(count: number)

Source from the content-addressed store, hash-verified

486
487// Should only be used via an assertion helper that inspects the yielded values.
488function unstable_flushNumberOfYields(count: number): void {
489 if (isFlushing) {
490 throw new Error('Already flushing work.');
491 }
492 if (scheduledCallback !== null) {
493 const cb = scheduledCallback;
494 expectedNumberOfYields = count;
495 isFlushing = true;
496 try {
497 let hasMoreWork = true;
498 do {
499 hasMoreWork = cb(true, currentMockTime);
500 } while (hasMoreWork && !didStop);
501 if (!hasMoreWork) {
502 scheduledCallback = null;
503 }
504 } finally {
505 expectedNumberOfYields = -1;
506 didStop = false;
507 isFlushing = false;
508 }
509 }
510}
511
512function unstable_flushUntilNextPaint(): false {
513 if (isFlushing) {

Callers

nothing calls this directly

Calls 1

cbFunction · 0.50

Tested by

no test coverage detected