0.2.0 • Published 2 years ago

bun-spinners v0.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

Bun Spinners

Simple tool for logging any number of spinners.

Preview

npm.io

Preview code

See test/index.test.ts.

import { spinners } from "bun-spinners";

const sleep = (ms: number) => new Promise(
  (resolve) => setTimeout(resolve, ms)
);

try {
  await spinners({
    "Starting APU...": async () => {
      await sleep(1000);
    },

    "Starting engines...": async () => {
      await sleep(5000);
      throw "Fuel mixture set to cutoff.";
    },

    "Setting flaps...": async () => {
      await sleep(2000);
    }
  })
} catch (e) {
  await spinners({
    "Aborting takeoff...": async () => {
      await sleep(3000);
    }
  });
}
0.2.0

2 years ago

0.1.0

2 years ago

0.0.3

2 years ago