Closed Elius94 closed 1 year ago
Control
Kind: global class Extends: Control
This class is an overload of Control that is used to create a Progress bar.
Emits the following events:
string
The id of the Progress.
number
The length of the Progress.
The thickness of the Progress.
The x position of the Progress.
The y position of the Progress.
ProgressStyle
The style of the Progress.
The theme of the Progress.
The orientation of the Progress.
boolean
If the Progress is interactive.
If the Progress is visible.
If the Progress is enabled.
Example
const pStyle = { boxed: true, showTitle: true, showValue: true, showPercentage: true, showMinMax: false, } const p = new Progress("prog1", 20, 1, 3, 23, pStyle, "htop", "horizontal") p.setText("Mem") const incr = setInterval(() => { const value = p.getValue() + 0.25 p.setValue(value) if (value >= p.getMax()) { clearInterval(incr) } }, 100) const p1Style = { background: "bgBlack", borderColor: "yellow", color: "green", boxed: true, showTitle: true, showValue: true, showPercentage: true, showMinMax: true, } const p1 = new Progress("prog2", 25, 2, 3, 25, p1Style, "precision", "horizontal") p1.setText("Precision") const incr1 = setInterval(() => { const value = p1.getValue() + 0.25 p1.setValue(value) if (value >= p1.getMax()) { clearInterval(incr1) } }, 100) const p2Style = { background: "bgBlack", borderColor: "yellow", color: "magenta", boxed: true, showTitle: true, showValue: true, showPercentage: true, showMinMax: true, } const p2 = new Progress("prog3", 25, 2, 3, 31, p2Style, "precision", "horizontal", true) p2.setText("Interactive") p2.on("valueChanged", (value) => { console.log(`Value changed: ${value}`) })
Progress ⇐
Control
Kind: global class
Extends:
Control
new Progress(id, length, thickness, x, y, style, theme, orientation, interactive, visible, enabled)
This class is an overload of Control that is used to create a Progress bar.
Emits the following events:
Example of interactive progress bar
string
The id of the Progress.
number
The length of the Progress.
number
The thickness of the Progress.
number
The x position of the Progress.
number
The y position of the Progress.
ProgressStyle
The style of the Progress.
string
The theme of the Progress.
string
The orientation of the Progress.
boolean
If the Progress is interactive.
boolean
If the Progress is visible.
boolean
If the Progress is enabled.
Example