All Projects → jcarpanelli → spinnies

jcarpanelli / spinnies

Licence: MIT license
Node.js module to create and manage multiple spinners in command-line interface programs

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to spinnies

Whirl
CSS loading animations with minimal effort!
Stars: ✭ 774 (+597.3%)
Mutual labels:  progress, spinner, loading, spinners, loading-bar, loading-spinner
Spinners React
Lightweight SVG/CSS spinners for React
Stars: ✭ 254 (+128.83%)
Mutual labels:  progress, spinner, loading, spinners, loading-spinner
spinners-angular
Lightweight SVG/CSS spinners for Angular
Stars: ✭ 21 (-81.08%)
Mutual labels:  progress, spinner, loading, spinners
Iprogresshud
An elegant, lightweight and responsive progress HUD for iOS app with very simple usage. Available 32 indicators by NVActivityIndicatorView.
Stars: ✭ 66 (-40.54%)
Mutual labels:  progress, loading, loading-bar, loading-spinner
cpp-indicators
A very simple, easy-to-use, and single-header-only C++ library for console based indicators (loading spinners)
Stars: ✭ 13 (-88.29%)
Mutual labels:  console, spinner, loading, loading-spinner
Ng4 Loading Spinner
Angular 4 custom async loading spinner.
Stars: ✭ 74 (-33.33%)
Mutual labels:  spinner, loading-bar, loading-spinner
react-awesome-loaders
🚀 High quality, super responsive and completely customisable Loading Animations to insert into your website with single line of code.
Stars: ✭ 146 (+31.53%)
Mutual labels:  progress, spinner, spinners
respinner
Pretty and customizable svg spinners for React.js
Stars: ✭ 89 (-19.82%)
Mutual labels:  spinner, loading, loading-spinner
busy-load
A flexible loading-mask jQuery-plugin
Stars: ✭ 76 (-31.53%)
Mutual labels:  spinner, loading, loading-spinner
React Circle
Renders a svg circle + progress, it just works 💘
Stars: ✭ 925 (+733.33%)
Mutual labels:  progress, spinner, loading
ZXLoadingView
🍕ZXLoadingView is an iOS progress-activity
Stars: ✭ 14 (-87.39%)
Mutual labels:  spinner, loading, spinners
Listr2
NodeJS Task List derived from the best! Create beautiful CLI interfaces via easy and logical to implement task lists that feel alive and interactive.
Stars: ✭ 73 (-34.23%)
Mutual labels:  console, progress, loading
Aframe Preloader Component
A preloading bar that automatically displays while scene assets load.
Stars: ✭ 27 (-75.68%)
Mutual labels:  spinner, spinners, loading-bar
SSSwiftUISpinnerButton
SSSwiftUISpinnerButton is a collection of various spinning animations for buttons in SwiftUI.
Stars: ✭ 37 (-66.67%)
Mutual labels:  loading, loading-spinner, loading-indicator
Vue Progress Path
Progress bars and loading indicators for Vue.js
Stars: ✭ 309 (+178.38%)
Mutual labels:  spinner, loading-bar, loading-spinner
Vue Wait
Complex Loader and Progress Management for Vue/Vuex and Nuxt Applications
Stars: ✭ 1,869 (+1583.78%)
Mutual labels:  progress, spinner, loading
React Nprogress
⌛️ A React primitive for building slim progress bars.
Stars: ✭ 173 (+55.86%)
Mutual labels:  progress, spinner, loading
Vue Loaders
Vue + loaders.css
Stars: ✭ 127 (+14.41%)
Mutual labels:  progress, spinner, loading
Alive Progress
A new kind of Progress Bar, with real-time throughput, ETA, and very cool animations!
Stars: ✭ 2,940 (+2548.65%)
Mutual labels:  progress, spinner, spinners
Asciichart
Nice-looking lightweight console ASCII line charts ╭┈╯ for NodeJS, browsers and terminal, no dependencies
Stars: ✭ 1,107 (+897.3%)
Mutual labels:  console, node-js

spin Spinnies spin

Node.js module to create and manage multiple spinners in command-line interface programs

npm CircleCI standard-readme compliant License: MIT


Installation

$ npm i spinnies

Usage & Example

const spinnies = new Spinnies();

spinnies.add('spinner-1', { text: 'I am a spinner' });
spinnies.add('spinner-2', { text: 'I am another spinner' });

setTimeout(() => {
  spinnies.succeed('spinner-1', { text: 'Success!' });
  spinnies.fail('spinner-2', { text: 'Fail :(' });
}, 2000);

API

This library follows a non-error-throwing philosophy. If you provide an invalid option or an invalid value for a valid option it will be ignored.

Initialization:

new Spinnies([options])

Parameters

  • options - object:
    • color - string: Any valid chalk color. The default value is white.

    • succeedColor - string: Any valid chalk color. The default value is green.

    • failColor - string: Any valid chalk color. The default value is red.

    • spinnerColor - string: Any valid chalk color. The default value is greenBright.

    • succeedPrefix - string: The default value is ✓.

    • failPrefix- string: The default value is .

    • spinner- object:

      • interval - number
      • frames - string[]

      You can see the already provided spinner here.

    • disableSpins - boolean: Disable spins (will still print raw messages).

Note: If you are working in any win32 platform, the default spin animation will be overriden. You can get rid of this defining a different spinner animation manually, or by using the integrated VSCode terminal or Windows Terminal.

Example:

const spinner = { interval: 80, frames: ['🍇', '🍈', '🍉', '🍋'] }
const spinnies = new Spinnies({ color: 'blue', succeedColor: 'green', spinner });

Instance methods:

add(name, [options])

Adds a new spinner with the given name.

Parameters:

  • name - string: spinner reference name.
  • options - object:
    • text: - string: Optional text to show in the spinner. If none is provided, the name field will be shown.
    • indent: - number: Optional, indent the spinner with the given number of spaces.
    • status - string: Initial status of the spinner. Valid statuses are: succeed, fail, spinning, non-spinnableand stopped.
    • color - string: Any valid chalk color.
    • succeedColor - string: Any valid chalk color.
    • failColor - string: Any valid chalk color.

Return value: Returns the spinner's options.

Example:

const spinnies = new Spinnies();
spinnies.add('spinner-1');
spinnies.add('another-spinner', { text: 'Hello, I am a spinner!', color: 'greenBright' });

pick(name)

Picks a spinner.

Parameters:

  • name - string: spinner reference name.

Return value: Returns the spinner's options.

remove(name)

Removes a spinner.

Parameters:

  • name - string: spinner reference name.

Return value: Returns the spinner's options.

update(name, [options])

Updates the spinner with name name with the provided options.

Parameters:

  • name - string: spinner reference name.
  • options - object:
    • text: - string: Optional text to show in the spinner. If none is provided, the name field will be shown.
    • status - string: New status of the spinner. Valid statuses are: succeed, fail, spinning, non-spinnableand stopped.
    • color - string: Any valid chalk color.
    • succeedColor - string: Any valid chalk color.
    • failColor - string: Any valid chalk color.

Return value: Returns the spinner's options.

Example:

const spinnies = new Spinnies();
spinnies.add('spinner-1', { text: 'Hello! I am the initial text', color: 'green' });
// some code
spinnies.update('spinner-1', { text: 'Hello, I am an updated text!', color: 'blue' });

succeed(name, [options])

Sets the specified spinner status as succeed.

Parameters:

  • name - string: spinner reference name.
  • options - object:
    • text: - string: Optional text to show in the spinner. If none is provided, the name field will be shown.
    • succeedColor - string: Any valid chalk color.

Return value: Returns the spinner's options.

Example:

const spinnies = new Spinnies();
spinnies.add('spinner-1', { text: 'Hello! I am the initial text', color: 'green' });
// some code
spinnies.succeed('spinner-1', { text: 'Success!', successColor: 'greenBright' });

fail(name, [options])

Sets the specified spinner status as fail.

Parameters:

  • name - string: spinner reference name.
  • options - object:
    • text: - string: Optional text to show in the spinner. If none is provided, the name field will be shown.
    • failColor - string: Any valid chalk color.

Return value: Returns the spinner's options.

Example:

const spinnies = new Spinnies();
spinnies.add('spinner-1', { text: 'Hello! I am the initial text', color: 'green' });
// some code
spinnies.fail('spinner-1', { text: 'I failed', failColor: 'redBright' });

stopAll([status])

Stops the spinners and sets the non-succeeded and non-failed ones to the provided status, which can be succeed, fail or stopped. You can see an example here.

hasActiveSpinners()

Return value: returns false if all spinners have succeeded, failed or have been stopped.

Contribute

Star it, fork it, improve it, PR it! 🙌.

Acknowledgements

Thanks to chalk for helping making this lib colorful 🌈 and to ora which was a great inspiration 🦄.

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].