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

Function performWork

code/third-party/public/app.js:12965–13007  ·  view source on GitHub ↗
(minExpirationTime, isAsync, dl)

Source from the content-addressed store, hash-verified

12963 }
12964
12965 function performWork(minExpirationTime, isAsync, dl) {
12966 deadline = dl;
12967
12968 // Keep working on roots until there's no more work, or until the we reach
12969 // the deadline.
12970 findHighestPriorityRoot();
12971
12972 if (enableUserTimingAPI && deadline !== null) {
12973 var didExpire = nextFlushedExpirationTime < recalculateCurrentTime();
12974 stopRequestCallbackTimer(didExpire);
12975 }
12976
12977 if (isAsync) {
12978 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime) && (!deadlineDidExpire || recalculateCurrentTime() >= nextFlushedExpirationTime)) {
12979 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, !deadlineDidExpire);
12980 findHighestPriorityRoot();
12981 }
12982 } else {
12983 while (nextFlushedRoot !== null && nextFlushedExpirationTime !== NoWork && (minExpirationTime === NoWork || minExpirationTime >= nextFlushedExpirationTime)) {
12984 performWorkOnRoot(nextFlushedRoot, nextFlushedExpirationTime, false);
12985 findHighestPriorityRoot();
12986 }
12987 }
12988
12989 // We're done flushing work. Either we ran out of time in this callback,
12990 // or there's no more work left with sufficient priority.
12991
12992 // If we're inside a callback, set this to false since we just completed it.
12993 if (deadline !== null) {
12994 callbackExpirationTime = NoWork;
12995 callbackID = -1;
12996 }
12997 // If there's work left over, schedule a new callback.
12998 if (nextFlushedExpirationTime !== NoWork) {
12999 scheduleCallbackWithExpiration(nextFlushedExpirationTime);
13000 }
13001
13002 // Clean-up.
13003 deadline = null;
13004 deadlineDidExpire = false;
13005
13006 finishRendering();
13007 }
13008
13009 function flushRoot(root, expirationTime) {
13010 !!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