MCPcopy
hub / github.com/facebook/react / flushTasks

Function flushTasks

packages/scheduler/src/__tests__/SchedulerPostTask-test.js:137–151  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

135 currentTime += ms;
136 }
137 function flushTasks() {
138 ensureLogIsEmpty();
139
140 // If there's a continuation, it will call postTask again
141 // which will set nextTask. That means we need to clear
142 // nextTask before the invocation, otherwise we would
143 // delete the continuation task.
144 const prevTaskQueue = taskQueue;
145 taskQueue = new Map();
146 for (const [, {id, callback, resolve}] of prevTaskQueue) {
147 log(`Task ${id} Fired`);
148 callback(false);
149 resolve();
150 }
151 }
152 function log(val) {
153 eventLog.push(val);
154 }

Callers

nothing calls this directly

Calls 4

ensureLogIsEmptyFunction · 0.70
logFunction · 0.70
callbackFunction · 0.50
resolveFunction · 0.50

Tested by

no test coverage detected