From 3b1fd5767a8f1660eeb1e0951b0b7c85ea516625 Mon Sep 17 00:00:00 2001 From: bubucuo Date: Tue, 18 Oct 2022 23:05:38 +0800 Subject: [PATCH] refactor: Flow: typing of Scheduler (#25485) Flow: typing of Scheduler. --- packages/scheduler/src/forks/Scheduler.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/scheduler/src/forks/Scheduler.js b/packages/scheduler/src/forks/Scheduler.js index 22c70f58486bf..3c6cacbdea920 100644 --- a/packages/scheduler/src/forks/Scheduler.js +++ b/packages/scheduler/src/forks/Scheduler.js @@ -85,8 +85,8 @@ var LOW_PRIORITY_TIMEOUT = 10000; var IDLE_PRIORITY_TIMEOUT = maxSigned31BitInt; // Tasks are stored on a min heap -var taskQueue = []; -var timerQueue = []; +var taskQueue: Array = []; +var timerQueue: Array = []; // Incrementing id counter. Used to maintain insertion order. var taskIdCounter = 1; @@ -121,7 +121,7 @@ const isInputPending = const continuousOptions = {includeContinuous: enableIsInputPendingContinuous}; -function advanceTimers(currentTime) { +function advanceTimers(currentTime: number) { // Check for tasks that are no longer delayed and add them to the queue. let timer = peek(timerQueue); while (timer !== null) { @@ -145,7 +145,7 @@ function advanceTimers(currentTime) { } } -function handleTimeout(currentTime) { +function handleTimeout(currentTime: number) { isHostTimeoutScheduled = false; advanceTimers(currentTime); @@ -162,7 +162,7 @@ function handleTimeout(currentTime) { } } -function flushWork(hasTimeRemaining, initialTime) { +function flushWork(hasTimeRemaining: boolean, initialTime: number) { if (enableProfiling) { markSchedulerUnsuspended(initialTime); } @@ -206,7 +206,7 @@ function flushWork(hasTimeRemaining, initialTime) { } } -function workLoop(hasTimeRemaining, initialTime) { +function workLoop(hasTimeRemaining: boolean, initialTime: number) { let currentTime = initialTime; advanceTimers(currentTime); currentTask = peek(taskQueue);