Skip to content

Commit

Permalink
fix: handler assignment should be happened after super() call
Browse files Browse the repository at this point in the history
  • Loading branch information
pi0 committed Nov 4, 2018
1 parent fc763a1 commit 150699d
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/plugin.js
Expand Up @@ -38,6 +38,11 @@ export default class WebpackBarPlugin extends ProgressPlugin {
this.options = Object.assign({}, DEFAULTS, options);
this.name = startCase(options.name);

// Assign a better handler to base ProgressPlugin
this.handler = (percent, message, ...details) => {
this.updateProgress(percent, message, details);
};

// Keep our state in shared ojbect
this.states = globalStates;
if (!this.states[this.name]) {
Expand Down Expand Up @@ -153,10 +158,6 @@ export default class WebpackBarPlugin extends ProgressPlugin {
});
}

handler(percent, message, ...details) {
this.updateProgress(percent, message, details);
}

updateProgress(percent = 0, message = '', details = []) {
const progress = Math.floor(percent * 100);

Expand Down

0 comments on commit 150699d

Please sign in to comment.