In part two of before your scripts load series we are going to figure out how to use the techniques that Flickr uses to handle this problem. To recap, if we use an async JS loader, or even if we just put our script tags at the bottom of our pages we have a problem. The is potential for a user to interact with the page before the code loads. This means there might not be any code around to handle what the user just did.
Flickr uses something they call an actionQueue, and there code to do that is in a very tight, isolated bunch of code. With very little modification I think we could use that exact same piece of code. We are going to build a simple webpage that exercises the code. To start we need to make a few changes to the original code so that we could have multiple modules loading instead of just one.
Note: I am using QUnit to run the tests
The code: