Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export const getIdleDispatcher = (stopWhenInactive, timeout, fn) =>
debounce(() => {
// the requestAnimationFrame ensures it doesn't run when tab isn't active
stopWhenInactive ? raf(() => ric(fn, ricOptions)) : ric(fn, ricOptions)
}, timeout)
init: store => {
const callback = debounce(store.doTrackWindowResize, 200)
workerProof((cb, debounce) => {
cb({
height: window.innerHeight,
width: window.innerWidth
})
window.addEventListener('resize', () => {
cb({
height: window.innerHeight,
width: window.innerWidth
})
}, {passive: true})
}, callback)
}
}