From c711d2a1efb19489392e9700eaa2496683eaff6b Mon Sep 17 00:00:00 2001 From: Vladimir Alexiev Date: Sat, 21 Jul 2018 11:55:09 +0300 Subject: [PATCH] `setTimeout` doesn't work, use another timeout function Patch from @ngyikp https://github.com/ngyikp/json-viewer/commit/6b5fa84b6bebe9275ac3fa949a4e8a0e9876a565 --- extension/src/json-viewer/load-css.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extension/src/json-viewer/load-css.js b/extension/src/json-viewer/load-css.js index 251e9aa8..3abce2d7 100644 --- a/extension/src/json-viewer/load-css.js +++ b/extension/src/json-viewer/load-css.js @@ -33,13 +33,13 @@ function loadCSS(opts) { } if (/loaded/.test(content)) { - clearTimeout(scheduleId); + cancelAnimationFrame(scheduleId); document.body.removeChild(checkElement); resolve(); } else { attempts++; - scheduleId = setTimeout(scheduleCheck, 1); + scheduleId = requestAnimationFrame(scheduleCheck, 1); } }