0.1.0 • Published 8 years ago

happy-spinner v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Spinner for happy devs :smile:

This spinner tries to get you happy while stuff is happening. For more awesome spinners check out ora.

Install

$ npm install --save happy-spinner

Usage

const text = 'Text be here'; // Optional
const interval = 100; // Optional
const happySpinner = require('happySpinner')(text, interval);

happySpinner.start();

setTimeout(() => {
	happySpinner.color = 'yellow';
	happySpinner.text = 'Loading rainbows';
}, 1000);

setTimeout(() => {
	happySpinner.succeed();
}, 3000);

API

text

Type: string Text to display after the spinner.

interval

Type: number Default: Provided by the spinner or 100

Interval between each frame.

Spinners provide their own recommended interval, so you don't really need to specify this.

Instance

.start()

Start the spinner. Returns the instance.

.stop()

Stop and clear the spinner. Returns the instance.

.succeed()

Stop the spinner, change it to a green and persist the text. Returns the instance.

.fail()

Stop the spinner, change it to a red and persist the text. Returns the instance.

.clear()

Clear the spinner. Returns the instance.

.render()

Manually render a new frame. Returns the instance.

.frame()

Get a new frame.

.text

Change the text.

.color

Change the spinner color.

Contributing

All Contributions are welcome! Please open up an issue if you would like to help out. :smile:

License

Created with ♥ by Tiaan du Plessis. Licensed under the MIT License.