Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
function ResourceBuilder(){
this._dependencyPromises = [];
ResourceBuilder.prototype._load = function () {
// specific to the resource...
ResourceBuilder.prototype.addDependency = function(dep){
ResourceBuilder.protototype.get = function(){
return Promise.all([this._load()].concat(this._dependencyPromises)).then(function(){
// both the resource and its dependencies are now loaded
// this was done in parallel.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.