MCPcopy Create free account
hub / github.com/microsoft/SandDance / advanceTimers

Function advanceTimers

docs/external/js/react.development.js:2519–2544  ·  view source on GitHub ↗
(currentTime)

Source from the content-addressed store, hash-verified

2517 var isHostTimeoutScheduled = false;
2518
2519 function advanceTimers(currentTime) {
2520 // Check for tasks that are no longer delayed and add them to the queue.
2521 var timer = peek(timerQueue);
2522
2523 while (timer !== null) {
2524 if (timer.callback === null) {
2525 // Timer was cancelled.
2526 pop(timerQueue);
2527 } else if (timer.startTime <= currentTime) {
2528 // Timer fired. Transfer to the task queue.
2529 pop(timerQueue);
2530 timer.sortIndex = timer.expirationTime;
2531 push(taskQueue, timer);
2532
2533 {
2534 markTaskStart(timer, currentTime);
2535 timer.isQueued = true;
2536 }
2537 } else {
2538 // Remaining timers are pending.
2539 return;
2540 }
2541
2542 timer = peek(timerQueue);
2543 }
2544 }
2545
2546 function handleTimeout(currentTime) {
2547 isHostTimeoutScheduled = false;

Callers 3

handleTimeoutFunction · 0.85
workLoopFunction · 0.85
unstable_shouldYieldFunction · 0.85

Calls 4

markTaskStartFunction · 0.85
peekFunction · 0.70
popFunction · 0.70
pushFunction · 0.70

Tested by

no test coverage detected