From ba4f11f60dead4e8f8c5ab745ae98884fa892812 Mon Sep 17 00:00:00 2001 From: Kushagra Gour Date: Thu, 15 Feb 2018 02:58:27 +0530 Subject: [PATCH] utils: add polyfill for requestIdlecallback --- src/utils.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/utils.js b/src/utils.js index 4570ce8..6e76ad4 100644 --- a/src/utils.js +++ b/src/utils.js @@ -20,6 +20,13 @@ return siblings[index + 1]; }; + // Safari doesn't have this! + window.requestIdleCallback = + window.requestIdleCallback || + function(fn) { + setTimeout(fn, 10); + }; + /* * @param Selector that should match for next siblings * @return element Next element that mathes `selector`