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

Method stop

lib/multi-bar.js:171–230  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

169 }
170
171 stop(){
172
173 // stop timer
174 clearTimeout(this.timer);
175 this.timer = null;
176
177 // remove sigint listener
178 if (this.sigintCallback){
179 process.removeListener('SIGINT', this.sigintCallback);
180 process.removeListener('SIGTERM', this.sigintCallback);
181 this.sigintCallback = null;
182 }
183
184 // set flag
185 this.isActive = false;
186
187 // cursor hidden ?
188 if (this.options.hideCursor === true){
189 this.terminal.cursor(true);
190 }
191
192 // re-enable line wrpaping ?
193 if (this.options.linewrap === false){
194 this.terminal.lineWrapping(true);
195 }
196
197 // reset cursor
198 this.terminal.cursorRelativeReset();
199
200 // trigger event
201 this.emit('stop-pre-clear');
202
203 // clear line on complete ?
204 if (this.options.clearOnComplete){
205 // clear all bars
206 this.terminal.clearBottom();
207
208 // or show final progress ?
209 }else{
210 // update each bar
211 for (let i=0; i< this.bars.length; i++){
212 // add new line ?
213 if (i > 0){
214 this.terminal.newline();
215 }
216
217 // trigger final rendering
218 this.bars[i].render();
219
220 // stop
221 this.bars[i].stop();
222 }
223
224 // new line on complete
225 this.terminal.newline();
226 }
227
228 // trigger event

Callers 12

updateMethod · 0.95
runMultibarFunction · 0.95
showPresetFunction · 0.45
showPresetFunction · 0.45
runSinglebarFunction · 0.45
Example5Function · 0.45
Example1Function · 0.45
Example2Function · 0.45
Example4Function · 0.45
Example5Function · 0.45
Example6Function · 0.45

Calls 6

cursorMethod · 0.80
lineWrappingMethod · 0.80
cursorRelativeResetMethod · 0.80
clearBottomMethod · 0.80
newlineMethod · 0.80
renderMethod · 0.45

Tested by

no test coverage detected