The classes extends EventEmitter which allows you to hook into different events.
Please take a look into the source code to get a closer look on the call order.
NOTE - in case you need additional events, don't hesitate to request them via an issue or pull request!
Triggered after start()
is called
const cliProgress = require('cli-progress');
const bar1 = new cliProgress.SingleBar();
bar1.on('start', () => {
console.log('bar started');
});
Triggered after stop()
is called
Triggered before the current line is updated
Triggered after the current line is updated
Triggered after a bar element is created and start()
is called
const cliProgress = require('cli-progress');
const bar1 = new cliProgress.MultiBar();
bar1.on('start', () => {
console.log('sub-bar element started');
});
Triggered after stop()
is called
Triggered when stop()
is called and the cursor is restored/reset to top position but before the final rendering/clearing is triggered.
Triggered when update()
is called.
Before any output is written to the terminal.
Triggered when update()
is called.
After cursor is resettet to initial position. Before the bar elements are rendered.
Triggered when update()
is called.
After cursor is resettet to initial position. After the bar elements are rendered.
Triggered when update()
is called.
After cursor is resettet to initial position. After the bar elements are rendered. After newline spacing is added in no-tty mode.