Skip to content

Commit 150699d

Browse files
committed
fix: handler assignment should be happened after super() call
1 parent fc763a1 commit 150699d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/plugin.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ export default class WebpackBarPlugin extends ProgressPlugin {
3838
this.options = Object.assign({}, DEFAULTS, options);
3939
this.name = startCase(options.name);
4040

41+
// Assign a better handler to base ProgressPlugin
42+
this.handler = (percent, message, ...details) => {
43+
this.updateProgress(percent, message, details);
44+
};
45+
4146
// Keep our state in shared ojbect
4247
this.states = globalStates;
4348
if (!this.states[this.name]) {
@@ -153,10 +158,6 @@ export default class WebpackBarPlugin extends ProgressPlugin {
153158
});
154159
}
155160

156-
handler(percent, message, ...details) {
157-
this.updateProgress(percent, message, details);
158-
}
159-
160161
updateProgress(percent = 0, message = '', details = []) {
161162
const progress = Math.floor(percent * 100);
162163

0 commit comments

Comments
 (0)