🎨 Use window.requestIdleCallback

This commit is contained in:
Daniel Gasienica 2018-03-23 10:11:01 -04:00
parent 5c9f18e1ae
commit 4a7cc22de3

View file

@ -29,7 +29,7 @@ class IdleDetector extends EventEmitter {
_scheduleNextCallback() {
this.stop();
this.handle = requestIdleCallback((deadline) => {
this.handle = window.requestIdleCallback((deadline) => {
const { didTimeout } = deadline;
const timeRemaining = deadline.timeRemaining();
const isIdle = timeRemaining >= IDLE_THRESHOLD_MS;