cli-loading-animation
TypeScript icon, indicating that this package has built-in type declarations

1.0.6 • Public • Published

cli-loading-animation

This library combines cli-spinners and log-update to display a loading animation in CLI apps made with Node.

Install

# NPM
npm install cli-loading-animation

# Yarn
yarn add cli-loading-animation

Example

const { loading } = require('cli-loading-animation');

const { start, stop } = loading('Loading..');

start();

setTimeout(() => stop(), 3000);

Custom Spinner

const { loading } = require('cli-loading-animation');
const spinners = require('cli-spinners');

const { start, stop } = loading('Loading..', { clearOnEnd: false, spinner: spinners.bouncingBall });

start();

setTimeout(() => stop(), 3000);

Where spinner can be a object with frames (an array of strings) and interval (a number) property.

The library cli-spinners already provide several spinners in this format.

Options

Option Description Default Value
spinner Custom Spinner to use dots from the cli-spinners library
clearOnEnd Specifies if the loading line on the console must be cleared on calling the stop function. true

License

MIT

Package Sidebar

Install

npm i cli-loading-animation

Weekly Downloads

373

Version

1.0.6

License

MIT

Unpacked Size

5.76 kB

Total Files

10

Last publish

Collaborators

  • matheusviegas