diff --git a/src/client/update.js b/src/client/update.js index 5c8eca1..3e661ee 100644 --- a/src/client/update.js +++ b/src/client/update.js @@ -1,10 +1,4 @@ import { rootConfigKey } from '../shared/constants' -import { hasGlobalWindow } from '../utils/window' - -const scheduleRefresh = (hasGlobalWindow && window.requestIdleCallback) || function (cb, { timeout }) { - return setTimeout(cb, timeout) -} -const cancelRefresh = (hasGlobalWindow && window.cancelIdleCallback) || clearTimeout // store an id to keep track of DOM updates let batchId = null @@ -38,10 +32,10 @@ export function batchUpdate (callback, timeout) { return } - cancelRefresh(batchId) - batchId = scheduleRefresh(() => { + clearTimeout(batchId) + batchId = setTimeout(() => { callback() - }, { timeout }) + }, timeout) return batchId }