Become a member
to unlock all features

Level Up!

Access all courses & lessons on egghead today and lock-in your price for life.


    Use requestIdleCallback to schedule JavaScript tasks at an optimal time

    Cameron NokesCameron Nokes

    JavaScript is single-threaded, which can present some problems when creating an interactive user experience. If JavaScript runs too long while a user is attempting to interact with a page, it can cause noticeable jank or lag, which degrades the experience. requestIdleCallback is a DOM API that allows you to schedule a JavaScript function to be run when the page thread is idle, so your JavaScript doesn't get in the way of the user.



    Become a Member to view code

    You must be a Member to view code

    Access all courses and lessons, track your progress, gain confidence and expertise.

    Become a Member
    and unlock code for this lesson