Skip to content

Commit

Permalink
fix: call done hook last
Browse files Browse the repository at this point in the history
  • Loading branch information
Pooya Parsa committed Mar 28, 2018
1 parent 6cb41ba commit 642a9ef
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,6 @@ Auto clear console when compile is finished.

A function that will be called when **all** builds are finished.

This function can optionally return `false` as a signal to stop rendering and printing profile stats.

### `buildTitle`
- Default: `BUILDING`

Expand Down
12 changes: 4 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,16 @@ export default class WebpackBarPlugin extends webpack.ProgressPlugin {
return;
}

if (typeof this.options.done === 'function') {
const result = this.options.done(sharedState, this);
if (result === false) {
// Special signal to do nothing
return;
}
}

this.render();

if (this.options.profile) {
const stats = sharedState[this.options.name].profile.getStats();
printStats(stats);
}

if (typeof this.options.done === 'function') {
this.options.done(sharedState, this);
}
}

updateProgress(percent, msg, details) {
Expand Down

0 comments on commit 642a9ef

Please sign in to comment.