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

Function performWork

code/styling/public/app.js:13732–13774  ·  view source on GitHub ↗
(minExpirationTime, isAsync, dl)

Source from the content-addressed store, hash-verified

13730 }
13731
13732 function performWork(minExpirationTime, isAsync, dl) {
13733 deadline = dl;
13734
13735 // Keep working on roots until there's no more work, or until the we reach
13736 // the deadline.
13737 findHighestPriorityRoot();
13738
13739 if (enableUserTimingAPI && deadline !== null) {
13740 var didExpire = nextFlushedExpirationTime < recalculateCurrentTime();
13741 stopRequestCallbackTimer(didExpire);
13742 }
13743
13744 if (isAsync) {
13745 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) {
13746 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire);
13747 findHighestPriorityRoot();
13748 }
13749 } else {
13750 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) {
13751 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false);
13752 findHighestPriorityRoot();
13753 }
13754 }
13755
13756 // We're done flushing work. Either we ran out of time in this callback,
13757 // or there's no more work left with sufficient priority.
13758
13759 // If we're inside a callback, set this to false since we just completed it.
13760 if (deadline !== null) {
13761 callbackExpirationTime = NoWork;
13762 callbackID = -1;
13763 }
13764 // If there's work left over, schedule a new callback.
13765 if (nextFlushedExpirationTime !== NoWork) {
13766 scheduleCallbackWithExpiration(nextFlushedExpirationTime);
13767 }
13768
13769 // Clean-up.
13770 deadline = null;
13771 deadlineDidExpire = false;
13772
13773 finishRendering();
13774 }
13775
13776 function flushRoot(root, expirationTime) {
13777 !!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