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

Function performWork

code/redux/public/app.js:13983–14025  ·  view source on GitHub ↗
(minExpirationTime, isAsync, dl)

Source from the content-addressed store, hash-verified

13981 }
13982
13983 function performWork(minExpirationTime, isAsync, dl) {
13984 deadline = dl;
13985
13986 // Keep working on roots until there's no more work, or until the we reach
13987 // the deadline.
13988 findHighestPriorityRoot();
13989
13990 if (enableUserTimingAPI && deadline !== null) {
13991 var didExpire = nextFlushedExpirationTime < recalculateCurrentTime();
13992 stopRequestCallbackTimer(didExpire);
13993 }
13994
13995 if (isAsync) {
13996 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) {
13997 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire);
13998 findHighestPriorityRoot();
13999 }
14000 } else {
14001 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) {
14002 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false);
14003 findHighestPriorityRoot();
14004 }
14005 }
14006
14007 // We're done flushing work. Either we ran out of time in this callback,
14008 // or there's no more work left with sufficient priority.
14009
14010 // If we're inside a callback, set this to false since we just completed it.
14011 if (deadline !== null) {
14012 callbackExpirationTime = NoWork;
14013 callbackID = -1;
14014 }
14015 // If there's work left over, schedule a new callback.
14016 if (nextFlushedExpirationTime !== NoWork) {
14017 scheduleCallbackWithExpiration(nextFlushedExpirationTime);
14018 }
14019
14020 // Clean-up.
14021 deadline = null;
14022 deadlineDidExpire = false;
14023
14024 finishRendering();
14025 }
14026
14027 function flushRoot(root, expirationTime) {
14028 !!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