Create a new Multispinner instance by providing a spinners collection and an optional options configuration object.
Spinners
You can define spinners in two ways:
- Array of strings: Each string acts as both the unique ID and the display text. Duplicate strings will cause the constructor to
throw. - Object: Use a
key: val format where key is the unique ID and val is the display text.
Options
Configurable settings include:
autoStart (default: true): If false, you must manually call .start().clear (default: false): If true, clears the terminal output using logUpdate.clear() once all spinners finish.frames (default: ['-', '\', '|', '/']): Array of strings used for the animation cycle.indent (default: 2): Number of character widths to indent spinners.interval (default: 80): Milliseconds between animation frames.preText (default: ''): Text inserted after the animation but before the spinner text.postText (default: ''): Text appended after the spinner text.color (default: { incomplete: 'blue', success: 'green', error: 'red' }): Uses Chalk compatible values. You can override specific states (e.g., { incomplete: 'yellow' }).symbol (default: { success: figures.tick, error: figures.cross }): Uses Figures by default. Any string is acceptable.
// Using an array
var multispinner = new Multispinner(['Foo', 'Bar', 'Baz']);
// Using an object
var multispinner = new Multispinner({
'Foo': 'Downloading Foo',
'Bar': 'Transpiling Bar',
'Baz': 'Writing Baz'
});
// Using options
var multispinner = new Multispinner(['foo', 'bar'], {
autoStart: false,
clear: true,
preText: 'Completing'
});