chalk-animation
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -8,2 +8,3 @@ #!/usr/bin/env node | ||
console.error('\nExample\n $ chalk-animation rainbow Hello world!'); | ||
// eslint-disable-next-line no-process-exit | ||
process.exit(2); | ||
@@ -14,2 +15,3 @@ } | ||
console.error('error: unknown animation name:', process.argv[2]); | ||
// eslint-disable-next-line no-process-exit | ||
process.exit(1); | ||
@@ -16,0 +18,0 @@ } |
@@ -127,2 +127,3 @@ 'use strict'; | ||
currentAnimation = { | ||
text: str, | ||
stopped: false, | ||
@@ -132,3 +133,3 @@ frame: 0, | ||
const self = this; | ||
log('\u001B[1F\u001B[G\u001B[2K' + effect(str, this.frame)); | ||
log('\u001B[1F\u001B[G\u001B[2K' + effect(this.text, this.frame)); | ||
setTimeout(() => { | ||
@@ -141,2 +142,5 @@ self.frame++; | ||
}, | ||
replace(str) { | ||
this.text = str; | ||
}, | ||
stop() { | ||
@@ -143,0 +147,0 @@ this.stopped = true; |
{ | ||
"name": "chalk-animation", | ||
"description": "Colorful animations in terminal stdout", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"author": "Boris K", | ||
@@ -6,0 +6,0 @@ "bugs": "https://github.com/bokub/chalk-animation/issues", |
@@ -37,3 +37,3 @@ # chalk-animation | ||
You can stop and restart an animation | ||
You can stop and restart an animation with `stop()` and `start()` | ||
@@ -69,3 +69,15 @@ ```javascript | ||
Change the animated text seamlessly with `replace()` | ||
```javascript | ||
let str = 'Loading...'; | ||
const rainbow = chalkAnimation.rainbow(str); | ||
// Add a new dot every second | ||
setInterval(() => { | ||
str += '.'; | ||
rainbow.replace(str); | ||
}, 1000); | ||
``` | ||
## CLI mode | ||
@@ -72,0 +84,0 @@ |
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
53975
15
173
114