Skip to content

Instantly share code, notes, and snippets.

@tommedema
Created November 9, 2010 16:32
Show Gist options
  • Save tommedema/669339 to your computer and use it in GitHub Desktop.
Save tommedema/669339 to your computer and use it in GitHub Desktop.
var HBPBLoader = function() { }
//scripts
HBPBLoader.scripts = [];
//add method
HBPBLoader.add = function(script) {
HBPBLoader.scripts.push(script);
};
//load method
HBPBLoader.load = function(doneCallback, counter) {
if (typeof(counter) != "number") counter = 0;
if (counter < HBPBLoader.scripts.length) {
$.getScript(HBPBLoader.scripts[counter], function() {
counter++;
HBPBLoader.load(doneCallback, counter);
});
}
else if (typeof(doneCallback) == "function") doneCallback();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment