Skip to content

Commit

Permalink
fix(Container): Fix Promise handling on #load(), change event namespa…
Browse files Browse the repository at this point in the history
…ce from 'open' to 'load' as spec
  • Loading branch information
bdfoster committed Nov 21, 2017
1 parent 0389925 commit 1f40417
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/Container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ export class Container extends AsyncEventEmitter {

if (this._isLoading) {
return new Promise((resolve) => {
this.on('open', (self) => {
this.on('load', (self) => {
resolve(self);
});
});
Expand All @@ -239,10 +239,11 @@ export class Container extends AsyncEventEmitter {
}

return Promise.all(results).then(() => {
this.emit('open', this);
this._isLoaded = true;
this._isLoading = false;
return this;
return this.emit('load', this).then(() => {
return this;
});
});
});
}
Expand Down

0 comments on commit 1f40417

Please sign in to comment.