()
| 94 | |
| 95 | // stop the bar |
| 96 | stop(){ |
| 97 | // timer inactive ? |
| 98 | if (!this.timer) { |
| 99 | return; |
| 100 | } |
| 101 | |
| 102 | // remove sigint listener |
| 103 | if (this.sigintCallback){ |
| 104 | process.removeListener('SIGINT', this.sigintCallback); |
| 105 | process.removeListener('SIGTERM', this.sigintCallback); |
| 106 | this.sigintCallback = null; |
| 107 | } |
| 108 | |
| 109 | // trigger final rendering |
| 110 | this.render(); |
| 111 | |
| 112 | // restore state |
| 113 | super.stop(); |
| 114 | |
| 115 | // stop timer |
| 116 | clearTimeout(this.timer); |
| 117 | this.timer = null; |
| 118 | |
| 119 | // cursor hidden ? |
| 120 | if (this.options.hideCursor === true){ |
| 121 | this.terminal.cursor(true); |
| 122 | } |
| 123 | |
| 124 | // re-enable line wrapping ? |
| 125 | if (this.options.linewrap === false){ |
| 126 | this.terminal.lineWrapping(true); |
| 127 | } |
| 128 | |
| 129 | // restore cursor on complete (position + settings) |
| 130 | this.terminal.cursorRestore(); |
| 131 | |
| 132 | // clear line on complete ? |
| 133 | if (this.options.clearOnComplete){ |
| 134 | this.terminal.cursorTo(0, null); |
| 135 | this.terminal.clearLine(); |
| 136 | }else{ |
| 137 | // new line on complete |
| 138 | this.terminal.newline(); |
| 139 | } |
| 140 | } |
| 141 | } |
nothing calls this directly
no test coverage detected