From 76a94c2c41b4ffedb11ab6882c8ef91f0a89491f Mon Sep 17 00:00:00 2001 From: Evan You Date: Thu, 8 Nov 2018 20:37:19 -0500 Subject: [PATCH] refactor: small tweaks --- packages/scheduler/src/experimental.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/scheduler/src/experimental.ts b/packages/scheduler/src/experimental.ts index 86972111..118f3bc8 100644 --- a/packages/scheduler/src/experimental.ts +++ b/packages/scheduler/src/experimental.ts @@ -18,7 +18,7 @@ type ErrorHandler = (err: Error) => any let currentJob: Job | null = null let start: number = 0 -const getNow = () => window.performance.now() +const getNow = () => performance.now() const frameBudget = __JSDOM__ ? Infinity : 1000 / 60 const patchQueue: Job[] = [] @@ -33,6 +33,7 @@ const pendingRejectors: ErrorHandler[] = [] const p = Promise.resolve() function flushAfterMicroTask() { + start = getNow() return p.then(flush).catch(handleError) } @@ -118,7 +119,6 @@ export function queueJob(rawJob: Function) { if (!hasPendingFlush) { hasPendingFlush = true - start = getNow() flushAfterMicroTask() } }