refactor: small tweaks
This commit is contained in:
parent
a95532495a
commit
76a94c2c41
@ -18,7 +18,7 @@ type ErrorHandler = (err: Error) => any
|
|||||||
let currentJob: Job | null = null
|
let currentJob: Job | null = null
|
||||||
|
|
||||||
let start: number = 0
|
let start: number = 0
|
||||||
const getNow = () => window.performance.now()
|
const getNow = () => performance.now()
|
||||||
const frameBudget = __JSDOM__ ? Infinity : 1000 / 60
|
const frameBudget = __JSDOM__ ? Infinity : 1000 / 60
|
||||||
|
|
||||||
const patchQueue: Job[] = []
|
const patchQueue: Job[] = []
|
||||||
@ -33,6 +33,7 @@ const pendingRejectors: ErrorHandler[] = []
|
|||||||
const p = Promise.resolve()
|
const p = Promise.resolve()
|
||||||
|
|
||||||
function flushAfterMicroTask() {
|
function flushAfterMicroTask() {
|
||||||
|
start = getNow()
|
||||||
return p.then(flush).catch(handleError)
|
return p.then(flush).catch(handleError)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,7 +119,6 @@ export function queueJob(rawJob: Function) {
|
|||||||
|
|
||||||
if (!hasPendingFlush) {
|
if (!hasPendingFlush) {
|
||||||
hasPendingFlush = true
|
hasPendingFlush = true
|
||||||
start = getNow()
|
|
||||||
flushAfterMicroTask()
|
flushAfterMicroTask()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user