Skip to content

refactor: Flow: typing of Scheduler #25485

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 1 commit into from
Oct 18, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions packages/scheduler/src/forks/Scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<Task> = [];
var timerQueue: Array<Task> = [];

// Incrementing id counter. Used to maintain insertion order.
var taskIdCounter = 1;
Expand Down Expand Up @@ -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) {
Expand All @@ -145,7 +145,7 @@ function advanceTimers(currentTime) {
}
}

function handleTimeout(currentTime) {
function handleTimeout(currentTime: number) {
isHostTimeoutScheduled = false;
advanceTimers(currentTime);

Expand All @@ -162,7 +162,7 @@ function handleTimeout(currentTime) {
}
}

function flushWork(hasTimeRemaining, initialTime) {
function flushWork(hasTimeRemaining: boolean, initialTime: number) {
if (enableProfiling) {
markSchedulerUnsuspended(initialTime);
}
Expand Down Expand Up @@ -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);
Expand Down