indicatrix
indicatrix Is A CLI Loading Indicator Implemented As A Changing Ellipsis (Triple-Dot).

yarn add -E indicatrixTable Of Contents
- Table Of Contents
- API
async indicatrix(text, promise, options=): TINDICATRIX_PLACEHOLDERenv- Copyright
API
The package is available by importing its default function:
import indicatrix from 'indicatrix'
async indicatrix(
text: string,
promise: !Promise<T>|function(...*): !Promise<T>,
options=: !Options,
): T
Will print the loading text and refresh the CLI line to show the ellipsis while the promise is loading.
- <kbd>text*</kbd>
string: The text to display in the CLI. - <kbd>promise</kbd>
(!Promise<T> | function(...): !Promise<T>): The promise or an async function that returns the promise. - <kbd>options</kbd>
!Options(optional): The optional options for the indicator, such as the refresh interval.
When called from the CLI application, indicatrix will print the supplied text and draw the ellipsis (. > .. > ... > .) animation at the end, until the promise is resolved.
Options: The optional options for the indicator, such as the refresh interval.
| Name | Type | Description | Default | |
|---|---|---|---|---|
| interval | number | The interval with which to update the screen. | 250 |
|
| writable | !(NodeJS.WriteStream \ | stream.Writable) | The writable stream used for printing data with the .write method. |
process.stdout |
import indicatrix from 'indicatrix'
(async () => {
const res = await indicatrix('Please wait', async () => {
await new Promise(r => setTimeout(r, 750))
return 'OK'
}, { interval: 100 })
console.log(res)
})()Please wait.
Please wait..
Please wait...
Please wait
Please wait.
Please wait..
Please wait...
Please waitOK
INDICATRIX_PLACEHOLDER env
When the INDICATRIX_PLACEHOLDER is set to anything other than 0, the package won't print the ... ellipsis, but append the static <INDICATRIX_PLACEHOLDER> string to the loading text instead. This is used by documentary to add an interactive placeholder:
Please waitOK
Copyright
|
© Art Deco™ 2020 |
|---|
