const hasIdleCallback = ('requestIdleCallback' in window);
export const scheduleCallback = (cb, options) => {
  return hasIdleCallback ? requestIdleCallback(cb, {
    timeout: 5000,
    ...options
  }) : requestAnimationFrame(cb);
};

// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
export const cancelCallback = id => {
  return hasIdleCallback ? cancelIdleCallback(id) : cancelAnimationFrame(id);
};