MCPcopy Create free account
hub / github.com/npkgz/cli-progress / start

Method start

lib/generic-bar.js:104–132  ·  view source on GitHub ↗
(total, startValue, payload)

Source from the content-addressed store, hash-verified

102
103 // start the progress bar
104 start(total, startValue, payload){
105 // set initial values
106 this.value = startValue || 0;
107 this.total = (typeof total !== 'undefined' && total >= 0) ? total : 100;
108
109 // set start value for progress calculation
110 this.startValue = (startValue || 0);
111
112 // store payload (optional)
113 this.payload = payload || {};
114
115 // store start time for duration+eta calculation
116 this.startTime = Date.now();
117
118 // reset stop time for 're-start' scenario (used for duration calculation)
119 this.stopTime = null;
120
121 // reset string line buffer (redraw detection)
122 this.lastDrawnString = '';
123
124 // initialize eta buffer
125 this.eta = new _ETA(this.options.etaBufferLength, this.startTime, this.value);
126
127 // set flag
128 this.isActive = true;
129
130 // start event
131 this.emit('start', total, startValue);
132 }
133
134 // stop the bar
135 stop(){

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected