Axinom Mosaic Libraries
    Preparing search index...

    Function scheduleIdleCallback

    • Safely schedules a callback to be executed when the browser is idle. Falls back to setTimeout if requestIdleCallback is not available.

      Parameters

      • callback: IdleRequestCallback

        The function to execute during idle time

      • Optionaloptions: IdleRequestOptions

        Optional configuration (timeout in ms)

      Returns IdleCallbackHandle

      A handle that can be passed to cancelScheduledCallback

      const handle = scheduleIdleCallback(() => {
      console.log('Running during idle time');
      });

      // Later, if needed:
      cancelScheduledCallback(handle);