Skip to content

Commit

Permalink
fix(plugins): install sequentially
Browse files Browse the repository at this point in the history
  • Loading branch information
EisenbergEffect committed Jan 10, 2015
1 parent 5127d4f commit cc78f9a
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions src/plugins.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ export class Plugins {
constructor(aurelia){
this.aurelia = aurelia;
this.info = [];
this.hasProcessed = false;
}

install(moduleId, config){
Expand All @@ -35,22 +34,19 @@ export class Plugins {
}

process(){
var toLoad = [],
aurelia = this.aurelia,
var aurelia = this.aurelia,
loader = aurelia.loader,
info = this.info,
i, ii;
current;

if(this.hasProcessed){
return Promise.resolve();
}

this.hasProcessed = true;
var next = function(){
if(current = info.shift()){
return loadPlugin(aurelia, loader, current).then(next);
}

for(i = 0, ii = info.length; i < ii; ++i){
toLoad.push(loadPlugin(aurelia, loader, info[i]));
return Promise.resolve();
}

return Promise.all(toLoad);
return next();
}
}

0 comments on commit cc78f9a

Please sign in to comment.