Skip to content

simplejack comes from its simplicity in approach and "jack of all trades" saying. I created it when facing with challenges building a binary for a cli tool I was making for work and the sheer joyful pain it was causing me trying to incorporate a spinner

License

Notifications You must be signed in to change notification settings

KazChe/simplejack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

simplejack

A lightweight, customizable terminal spinner for Node.js applications.

Features

  • Simple and intuitive API
  • Customizable animation frames
  • Dynamic text updates
  • Success and error states
  • Manual control
  • Unicode character support

Installation

Usage

import SimpleSpinner from "simplejack";

// Basic usage
const spinner = new SimpleSpinner("Processing...");
spinner.start();

// After some work
spinner.succeed("Complete!");

// Or on error
spinner.fail("Failed!");

Examples

Custom Animation Frames

const customFrames = ["🌑", "🌒", "🌓", "🌔", "🌕", "🌖", "🌗", "🌘"];
const spinner = new SimpleSpinner("Loading...", customFrames);
spinner.start();

Dynamic Text Updates

const spinner = new SimpleSpinner("Starting up...");
spinner.start();

// Update text during operation
spinner.setText("Processing data...");

Error Handling

const spinner = new SimpleSpinner("Downloading...");
spinner.start();

// On error
spinner.fail("Download failed: Connection timeout");

API

Constructor

new SimpleSpinner(
  (text = "Loading..."), // Default text
  (frames = [
    // Default animation frames
    "⠋",
    "⠙",
    "⠹",
    "⠸",
    "⠼",
    "⠴",
    "⠦",
    "⠧",
    "⠇",
    "⠏",
  ])
);

Methods

  • start(): Starts the spinner
  • stop(finalText): Stops the spinner with optional final text
  • succeed(text): Stops with success indicator (✅)
  • fail(text): Stops with error indicator (❌)
  • setText(text): Updates the spinner text

License

MIT

About

simplejack comes from its simplicity in approach and "jack of all trades" saying. I created it when facing with challenges building a binary for a cli tool I was making for work and the sheer joyful pain it was causing me trying to incorporate a spinner

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published