Skip to content

Commit 91512c1

Browse files
committed
feat: use a shared throttle for bars
1 parent 5f03a5a commit 91512c1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/reporters/bars.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,15 @@ import { BULLET, TICK } from '../utils/consts';
99

1010
const globalConsole = console; // eslint-disable-line no-console
1111

12+
const renderT = throttle((fn, ...args) => fn(...args), 1, 50);
13+
1214
export default class BarsReporter {
1315
constructor() {
14-
this.renderT = throttle(this.render.bind(this), 1, 100);
16+
this._render = this._render.bind(this);
1517
this.drafts = null;
1618
}
1719

1820
compiling() {
19-
// eslint-disable-next-line no-console
2021
if (!globalConsole.draft) {
2122
draftLog.into(globalConsole);
2223
}
@@ -26,14 +27,14 @@ export default class BarsReporter {
2627
}
2728

2829
compiled(context) {
29-
this.render(context);
30+
this._render(context);
3031
}
3132

3233
update(context) {
33-
this.renderT(context);
34+
renderT(this._render, context);
3435
}
3536

36-
render(context) {
37+
_render(context) {
3738
const {
3839
state,
3940
options: { stream, name },

0 commit comments

Comments
 (0)