(opts: ConfirmOptions)
| 17 | } |
| 18 | |
| 19 | constructor(opts: ConfirmOptions) { |
| 20 | super(opts, false); |
| 21 | this.value = !!opts.initialValue; |
| 22 | |
| 23 | this.on('userInput', () => { |
| 24 | this.value = this._value; |
| 25 | }); |
| 26 | |
| 27 | this.on('confirm', (confirm) => { |
| 28 | this.output.write(cursor.move(0, -1)); |
| 29 | this.value = confirm; |
| 30 | this.state = 'submit'; |
| 31 | this.close(); |
| 32 | }); |
| 33 | |
| 34 | this.on('cursor', () => { |
| 35 | this.value = !this.value; |
| 36 | }); |
| 37 | } |
| 38 | } |