SpinnerOptions
The SpinnerOptions type defines the configuration options for a spinner component in ts-better-console. Spinners provide a visual loading indicator in the terminal and can be customized with different animation styles, custom frames, and intervals.
Type Definition
The SpinnerOptions type includes the following properties:
style: An optionalSpinnerStylevalue that determines the animation style of the spinner. Available styles are"dots","line","bounce","arrow", and"moon".frames: An optional array of strings that define custom animation frames for the spinner, overriding the default style.interval: An optional number (in milliseconds) that sets the speed of the spinner animation.
type SpinnerOptions = {
style?: SpinnerStyle;
frames?: string[];
interval?: number;
}
Usage
You can pass SpinnerOptions when creating a spinner to customize its behavior:
import { Spinner } from "ts-better-console";
// Using a built-in style
new Spinner({style: "dots",interval: 80,}).start();
// Using custom frames
new Spinner({frames: ["🌑", "🌒", "🌓", "🌔", "🌕"],interval: 150,}).start();
Want to support this project?
If you find ts-better-console useful and want to support its development, consider starring the GitHub repository or buying me a coffee! Your support helps me dedicate more time to improving the library and adding new features.
Want to contribute to this project?
Contributions are welcome! If you're interested in improving the library, fixing bugs, or adding new features, feel free to check out the GitHub repository and submit a pull request. Whether you're a seasoned developer or new to open source, your contributions can make a difference!