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

Function Example1

examples/example.js:13–42  ·  view source on GitHub ↗
(onComplete)

Source from the content-addressed store, hash-verified

11});});});});});});
12
13function Example1(onComplete){
14 // EXAMPLE 1 ---------------------------------------------
15 console.log('\nExample 1 - Standard configuration (4s)');
16 // create new progress bar using default values
17 const b1 = new _progress.Bar();
18 b1.start(200, 0);
19
20 // the bar value - will be linear incremented
21 let value = 0;
22
23 // 20ms update rate
24 const timer = setInterval(function(){
25 // increment value
26 value++;
27
28 // update the bar value
29 b1.update(value)
30
31 // set limit
32 if (value >= b1.getTotal()){
33 // stop timer
34 clearInterval(timer);
35
36 b1.stop();
37
38 // run complete callback
39 onComplete.apply(this);
40 }
41 }, 20);
42}
43
44
45function Example2(onComplete){

Callers 1

example.jsFile · 0.85

Calls 5

logMethod · 0.80
getTotalMethod · 0.80
startMethod · 0.45
updateMethod · 0.45
stopMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…