light-spinner
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -13,4 +13,2 @@ import { IOption } from './interface'; | ||
stop(): void; | ||
show(): void; | ||
private hide; | ||
private clearLine; | ||
@@ -17,0 +15,0 @@ private output; |
@@ -17,3 +17,2 @@ "use strict"; | ||
this.doing(); | ||
this.hide(); | ||
} | ||
@@ -23,15 +22,15 @@ stop() { | ||
this.clearLine(); | ||
this.show(); | ||
} | ||
show() { | ||
process.stdout.write('\u001b[?25h'); | ||
} | ||
hide() { | ||
process.stdout.write('\u001b[?25l'); | ||
} | ||
clearLine() { | ||
const clearChar = '\u001b[2K'; | ||
process.stdout.write(clearChar); | ||
const moveCursor = `\u001b[${Buffer.byteLength(this.message || '')}D`; | ||
process.stdout.write(moveCursor); | ||
const messageLine = (this.message || '').split('\n'); | ||
while (messageLine.length) { | ||
const message = messageLine.pop(); | ||
const clearChar = '\u001b[2K'; | ||
const moveCursor = `\u001b[${Buffer.byteLength(message)}D`; | ||
process.stdout.write(clearChar); | ||
process.stdout.write(moveCursor); | ||
if (messageLine.length) { | ||
process.stdout.write('\u001b[1F'); | ||
} | ||
} | ||
} | ||
@@ -43,3 +42,3 @@ output(message) { | ||
doing() { | ||
const message = `${this.spinners[this.index++]} ${this.text || ''}`; | ||
const message = `${this.spinners[this.index++]} ${this.text || ''}${this.isWin ? '' : '\n'}`; | ||
this.clearLine(); | ||
@@ -46,0 +45,0 @@ this.output(message); |
{ | ||
"name": "light-spinner", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "light-spinner", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -20,7 +20,8 @@ <p align="center"> | ||
<br /> | ||
<br/> | ||
<br /> | ||
<img src="https://raw.githubusercontent.com/echosoar/light-spinner/master/spin.gif" /> | ||
</p> | ||
![effect](https://raw.githubusercontent.com/echosoar/light-spinner/master/light-spinner.gif) | ||
## Install | ||
@@ -27,0 +28,0 @@ ```shell |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5573
52
74