(onComplete)
| 76 | } |
| 77 | |
| 78 | function Example3(onComplete){ |
| 79 | // EXAMPLE 3 --------------------------------------------- |
| 80 | console.log('\nExample 3 - Stop the Bar Automatically'); |
| 81 | // create new progress bar using default values |
| 82 | const b3 = new _progress.Bar({ |
| 83 | stopOnComplete: true, |
| 84 | clearOnComplete: true |
| 85 | }); |
| 86 | b3.start(200, 0); |
| 87 | |
| 88 | // the bar value - will be linear incremented |
| 89 | let value = 0; |
| 90 | |
| 91 | // 20ms update rate |
| 92 | const timer = setInterval(function(){ |
| 93 | // increment value |
| 94 | value++; |
| 95 | |
| 96 | // update the bar value |
| 97 | b3.update(value); |
| 98 | |
| 99 | // set limit |
| 100 | if (value >= b3.getTotal()){ |
| 101 | // stop timer |
| 102 | clearInterval(timer); |
| 103 | |
| 104 | // run complete callback |
| 105 | onComplete.apply(this); |
| 106 | } |
| 107 | }, 20); |
| 108 | } |
| 109 | |
| 110 | function Example4(onComplete){ |
| 111 | // EXAMPLE 1 --------------------------------------------- |
no test coverage detected
searching dependent graphs…