nanospinner
Advanced tools
Comparing version 0.3.2 to 0.4.0
interface Options { | ||
text?: string | ||
stream?: NodeJS.WriteStream | ||
frames?: string[] | ||
interval?: number | ||
frames?: string[] | ||
text?: string | ||
} | ||
interface Spinner { | ||
success(opts?: { text?: string; mark?: string }): Spinner | ||
error(opts?: { text?: string; mark?: string }): Spinner | ||
stop(opts?: { text?: string; mark?: string }): Spinner | ||
start(opts?: { text?: string }): Spinner | ||
update(opts?: Options): Spinner | ||
reset(): Spinner | ||
clear(): Spinner | ||
spin(): Spinner | ||
stop(opts?: { text?: string; mark?: string }): Spinner | ||
start(opts?: { text?: string }): Spinner | ||
error(opts?: { text?: string; mark?: string }): Spinner | ||
success(opts?: { text?: string; mark?: string }): Spinner | ||
} | ||
export function createSpinner(text?: string, opts?: Options): Spinner |
18
index.js
@@ -26,10 +26,16 @@ const { green, red, yellow } = require('picocolors') | ||
clear() { | ||
spinner.write('\x1b[1G') | ||
for (let i = 0; i < lines; i++) { | ||
i > 0 && spinner.write('\x1b[1A') | ||
spinner.write('\x1b[2K\x1b[1G') | ||
} | ||
lines = 0 | ||
return spinner | ||
}, | ||
write(str, clear = false) { | ||
if (clear && isTTY) { | ||
spinner.write('\x1b[1G') | ||
for (let i = 0; i < lines; i++) { | ||
i > 0 && spinner.write('\x1b[1A') | ||
spinner.write('\x1b[2K\x1b[1G') | ||
} | ||
lines = 0 | ||
spinner.clear() | ||
} | ||
@@ -36,0 +42,0 @@ |
{ | ||
"name": "nanospinner", | ||
"version": "0.3.2", | ||
"version": "0.4.0", | ||
"description": "The simplest and tiniest terminal spinner for Node.js", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
5211
120