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

Function runMultibar

examples/example-synchronous.js:33–58  ·  view source on GitHub ↗
(options, limit)

Source from the content-addressed store, hash-verified

31}
32
33function runMultibar(options, limit){
34 // create new progress bar using default values
35 const multibar = new _progress.MultiBar(options);
36
37 const bar1 = multibar.create(limit, 1);
38 const bar2 = multibar.create(2124, 541);
39
40 const fibonacciNumbers = [];
41
42 // calculate the Nth fibonacci
43 // this loop is executed synchronous - no timer/interval callbacks will be executed
44 for (let i = 1; i <= limit; i++) {
45 fibonacciNumbers.push(fibonacci(i));
46 bar1.update(i);
47 bar2.increment(89);
48
49 // force redraw
50 multibar.update();
51 }
52
53 // stop all bars
54 multibar.stop();
55
56 // display the numbers:
57 console.log('\nFibonacci (1-', fibonacciNumbers.length,'): ', fibonacciNumbers.join(', '), '\n');
58}
59
60console.log('\nCalculation without synchronous updates');
61runSinglebar({

Callers 1

Calls 7

createMethod · 0.95
updateMethod · 0.95
stopMethod · 0.95
fibonacciFunction · 0.85
incrementMethod · 0.80
logMethod · 0.80
updateMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…