MCPcopy
hub / github.com/plotly/dash / workLoop

Function workLoop

dash/deps/react@18.2.0.js:2635–2685  ·  view source on GitHub ↗
(hasTimeRemaining, initialTime)

Source from the content-addressed store, hash-verified

2633 }
2634
2635 function workLoop(hasTimeRemaining, initialTime) {
2636 var currentTime = initialTime;
2637 advanceTimers(currentTime);
2638 currentTask = peek(taskQueue);
2639
2640 while (currentTask !== null && !(enableSchedulerDebugging )) {
2641 if (currentTask.expirationTime > currentTime && (!hasTimeRemaining || shouldYieldToHost())) {
2642 // This currentTask hasn't expired, and we've reached the deadline.
2643 break;
2644 }
2645
2646 var callback = currentTask.callback;
2647
2648 if (typeof callback === 'function') {
2649 currentTask.callback = null;
2650 currentPriorityLevel = currentTask.priorityLevel;
2651 var didUserCallbackTimeout = currentTask.expirationTime <= currentTime;
2652
2653 var continuationCallback = callback(didUserCallbackTimeout);
2654 currentTime = getCurrentTime();
2655
2656 if (typeof continuationCallback === 'function') {
2657 currentTask.callback = continuationCallback;
2658 } else {
2659
2660 if (currentTask === peek(taskQueue)) {
2661 pop(taskQueue);
2662 }
2663 }
2664
2665 advanceTimers(currentTime);
2666 } else {
2667 pop(taskQueue);
2668 }
2669
2670 currentTask = peek(taskQueue);
2671 } // Return whether there's additional work
2672
2673
2674 if (currentTask !== null) {
2675 return true;
2676 } else {
2677 var firstTimer = peek(timerQueue);
2678
2679 if (firstTimer !== null) {
2680 requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);
2681 }
2682
2683 return false;
2684 }
2685 }
2686
2687 function unstable_runWithPriority(priorityLevel, eventHandler) {
2688 switch (priorityLevel) {

Callers 1

flushWorkFunction · 0.70

Calls 7

getCurrentTimeFunction · 0.85
advanceTimersFunction · 0.70
peekFunction · 0.70
shouldYieldToHostFunction · 0.70
popFunction · 0.70
requestHostTimeoutFunction · 0.70
callbackFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…