ProgressBar constructor
ProgressBar(})
Initialize a ProgressBar
with the given format
string and the options
map.
Format tokens:
:bar
the progress bar itself:current
current tick number:total
total ticks:elapsed
time elapsed in seconds:percent
completion percentage:eta
eta in seconds
Options:
total
total number of ticks to completewidth
the displayed width of the progress bar defaulting to totalcompleteChar
completion character defaulting to "="incompleteChar
incomplete character defaulting to "-"callback
optional function to call when the progress bar completesclear
will clear the progress bar upon termination
Implementation
ProgressBar(
this.format, {
this.total = 0,
this.width = 0,
this.clear = false,
this.completeChar = '=',
this.incompleteChar = '-',
this.callback,
}) {
if (width <= 0 && total > 0) {
width = total;
}
}