requestidlecallback-polyfill
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.2 • Public • Published

    requestIdleCallback polyfill

    Simple polyfill and d.ts for requestIdleCallback.

    From MDN:

    The window.requestIdleCallback() method queues a function to be called during a browser's idle periods. This enables developers to perform background and low priority work on the main event loop, without impacting latency-critical events such as animation and input response. Functions are generally called in first-in-first-out order; however, callbacks which have a timeout specified may be called out-of-order if necessary in order to run them before the timeout elapses.

    You can call requestIdleCallback() within an idle callback function to schedule another callback to take place no sooner than the next pass through the event loop.

    Install

    npm i requestidlecallback-polyfill

    or

    yarn add requestidlecallback-polyfill

    Usage

    import 'requestidlecallback-polyfill';
     
    // ...
     
    window.requestIdleCallback(doSomething, {timeout: 2000});

    Credits

    License

    Install

    npm i requestidlecallback-polyfill

    DownloadsWeekly Downloads

    16,582

    Version

    1.0.2

    License

    MIT AND Apache-2.0

    Unpacked Size

    3.23 kB

    Total Files

    4

    Last publish

    Collaborators

    • pladaria