Running Your Code at the Right Time

Run your code at the right time by making sense of DOMContentLoaded, load, async, defer, and position in the DOM!
This is a companion discussion topic for the original entry at


This was an intelligent topic and although 2.5 years old is relevant today. How would you go about loading jQuery, bootstrap,js and waypoint.js (the latter 2 dependent on jQuery). Ideally I would want all three libraries to be loaded asynchrously, but prevent javascript execution until all 3 javascript libraries have been loaded?


What you can use is:

It is great because it was designed almost exclusively for this scenario. You can specify your jquery as the primary and then the rest as dependents :slight_smile:


Thanks for getting back to me. I investigated and like others before me found it a little bulky for what I wanted it for. I ended up using load.js, but may use requirejs in the future.