MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / performWork

Function performWork

code/higher-order-components/public/app.js:13726–13768  ·  view source on GitHub ↗
(minExpirationTime, isAsync, dl)

Source from the content-addressed store, hash-verified

13724 }
13725
13726 function performWork(minExpirationTime, isAsync, dl) {
13727 deadline = dl;
13728
13729 // Keep working on roots until there's no more work, or until the we reach
13730 // the deadline.
13731 findHighestPriorityRoot();
13732
13733 if (enableUserTimingAPI && deadline !== null) {
13734 var didExpire = nextFlushedExpirationTime < recalculateCurrentTime();
13735 stopRequestCallbackTimer(didExpire);
13736 }
13737
13738 if (isAsync) {
13739 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) {
13740 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire);
13741 findHighestPriorityRoot();
13742 }
13743 } else {
13744 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) {
13745 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false);
13746 findHighestPriorityRoot();
13747 }
13748 }
13749
13750 // We're done flushing work. Either we ran out of time in this callback,
13751 // or there's no more work left with sufficient priority.
13752
13753 // If we're inside a callback, set this to false since we just completed it.
13754 if (deadline !== null) {
13755 callbackExpirationTime = NoWork;
13756 callbackID = -1;
13757 }
13758 // If there's work left over, schedule a new callback.
13759 if (nextFlushedExpirationTime !== NoWork) {
13760 scheduleCallbackWithExpiration(nextFlushedExpirationTime);
13761 }
13762
13763 // Clean-up.
13764 deadline = null;
13765 deadlineDidExpire = false;
13766
13767 finishRendering();
13768 }
13769
13770 function flushRoot(root, expirationTime) {
13771 !!isRendering ? invariant(false, 'work.commit(): Cannot commit while already rendering. This likely means you attempted to commit from inside a lifecycle method.') : void 0;

Callers 5

performAsyncWorkFunction · 0.70
performSyncWorkFunction · 0.70
interactiveUpdatesFunction · 0.70
flushInteractiveUpdatesFunction · 0.70
flushControlledFunction · 0.70

Calls 6

findHighestPriorityRootFunction · 0.70
recalculateCurrentTimeFunction · 0.70
stopRequestCallbackTimerFunction · 0.70
performWorkOnRootFunction · 0.70
finishRenderingFunction · 0.70

Tested by

no test coverage detected