Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
function ResourceBuilder(){
this._dependencies = [];
}
ResourceBuilder.prototype.addDependency = function(dep){
this._dependencies.add(dep);
}
ResourceBuilder.protototype.get = function(){
var loadPromises = this._dependencies.map(loadDependency); // alternatively, dependencies could be promises already
return Promise.all(loadPromises).then(function(loadedResourcesArray){
// do something with obj, or return the resource
});
}
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.