Skip to content

Commit 5474407

Browse files
committed
fix: use Date.now instead of performance.now to stay platform independent
1 parent 94e63a8 commit 5474407

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/scheduling.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function processCriticalQueue (queue) {
2626
}
2727

2828
function runQueuedHighTasks () {
29-
const startTime = performance.now()
29+
const startTime = Date.now()
3030
const isEmpty = processIdleQueues(priorities.HIGH, startTime)
3131
// there are more tasks to run in the next cycle
3232
if (!isEmpty) {
@@ -35,7 +35,7 @@ function runQueuedHighTasks () {
3535
}
3636

3737
function runQueuedLowTasks () {
38-
const startTime = performance.now()
38+
const startTime = Date.now()
3939
const isEmpty = processIdleQueues(priorities.LOW, startTime)
4040
// there are more tasks to run in the next cycle
4141
if (!isEmpty) {
@@ -60,7 +60,7 @@ function processIdleQueues (priority, startTime) {
6060
function processIdleQueue (queue, startTime) {
6161
const iterator = queue[Symbol.iterator]()
6262
let task = iterator.next()
63-
while (performance.now() - startTime < TARGET_INTERVAL) {
63+
while (Date.now() - startTime < TARGET_INTERVAL) {
6464
if (task.done) {
6565
return true
6666
}

0 commit comments

Comments
 (0)