@samitouri / QOS-React-2 / commits / 3b1fd5767a

refactor: Flow: typing of Scheduler (#25485)

Flow: typing of Scheduler.

bubucuo committed Oct 18, 2022 at 23:05 UTC 3b1fd5767a8f1660eeb1e0951b0b7c85ea516625
1 file changed +6 -6
packages/scheduler/src/forks/Scheduler.js
+6 -6
@@ -85,8 +85,8 @@ var LOW_PRIORITY_TIMEOUT = 10000;
85 var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt;
86
87 // Tasks are stored on a min heap
88 -var taskQueue = [];
89 -var timerQueue = [];
88 +var taskQueue: Array<Task> = [];
89 +var timerQueue: Array<Task> = [];
90
91 // Incrementing id counter. Used to maintain insertion order.
92 var taskIdCounter = 1;
@@ -121,7 +121,7 @@ const isInputPending =
121
122 const continuousOptions = {includeContinuous: enableIsInputPendingContinuous};
123
124 -function advanceTimers(currentTime) {
124 +function advanceTimers(currentTime: number) {
125 // Check for tasks that are no longer delayed and add them to the queue.
126 let timer = peek(timerQueue);
127 while (timer !== null) {
@@ -145,7 +145,7 @@ function advanceTimers(currentTime) {
145 }
146 }
147
148 -function handleTimeout(currentTime) {
148 +function handleTimeout(currentTime: number) {
149 isHostTimeoutScheduled = false;
150 advanceTimers(currentTime);
151
@@ -162,7 +162,7 @@ function handleTimeout(currentTime) {
162 }
163 }
164
165 -function flushWork(hasTimeRemaining, initialTime) {
165 +function flushWork(hasTimeRemaining: boolean, initialTime: number) {
166 if (enableProfiling) {
167 markSchedulerUnsuspended(initialTime);
168 }
@@ -206,7 +206,7 @@ function flushWork(hasTimeRemaining, initialTime) {
206 }
207 }
208
209 -function workLoop(hasTimeRemaining, initialTime) {
209 +function workLoop(hasTimeRemaining: boolean, initialTime: number) {
210 let currentTime = initialTime;
211 advanceTimers(currentTime);
212 currentTask = peek(taskQueue);