decrunch
v0.1.0
Published
An obstrusive loading indicator for the terminal, reminiscent of Commodore 64's "decrunching"
Maintainers
Readme
decrunch
An obstrusive loading indicator for the terminal, reminiscent of Commodore 64's "decrunching".
Installation
npm install decrunchUsage
Promise Wrapper
Wrap any async task with the loading animation:
import { whileDecrunching } from './animation.js';
// Wrap any promise
const result = await whileDecrunching(
fetch('https://api.example.com/data'), {
// default options
border: 0,
fps: 25
}
);Manual Control
Start and stop the animation manually:
import { startDecrunching } from './animation.js';
const stopDecrunching = startDecrunching({
// default options
border: 0
fps: 30,
});
// Do your work...
await someTask();
stopDecrunching();CLI
npx decrunch sleep 3API
whileDecrunching<T>(task: Promise<T>, options?: AnimationOptions): Promise<T>
Runs a loading animation while waiting for a promise to resolve.
startDecrunching(options?: AnimationOptions): () => void
Starts the animation and returns a function to stop it.
Options
Both exported function accept the same options object:
`option.border``
Type: number
Default: 25
Border with on all sides.
`option.fps``
Type: number
Default: 25
Frames per second.
License ©️
This work is licensed under The MIT License.
