1.2.3 • Published 6 years ago

logf-spinner v1.2.3

Weekly downloads
5
License
MIT
Repository
github
Last release
6 years ago

LogF-Spinner · License: MIT build status Coverage Status

Simple terminal spinner. Usable standalone or with other log-frame components.

Install

npm install logf-spinner

Usage

const { LogFrame } = require('log-frame');
const { Spinner } = require('logf-spinner');

// create, configure, and start spinner
const spinner = new Spinner('dots');
spinner.text = 'loading';
spinner.color = 'cyan';
spinner.start();

// attach to frame for display
const frame = new LogFrame();
frame.view = spinner;

API

new Spinner('theme')

theme

The name of a spinner theme from cli-spinners. Some examples:

Or a custom theme object:

new Spinner({
  frames: ['-', '|'],
  interval: 40, // optional, default is 20
});

Methods

.start()

Start spinning.

.stop()

Stop spinning.

Properties

.text (string)

Optional text to display next to the spinner.

.color (string)

Optional color tint to apply to the spinner.