From 355e172426602f53b112ba33cee3f241c49fa596 Mon Sep 17 00:00:00 2001 From: pimlie Date: Tue, 8 Oct 2019 13:11:50 +0200 Subject: [PATCH] Revert "refactor: batch updates using requestIdleCallback, use setTimeout as fallback" This reverts commit 8c75ec1356dbf2cdee7a94c5987c8df417538d07. --- src/client/update.js | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) 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 }