spinner

Types

pub opaque type Builder
pub opaque type Spinner

Constants

pub const clock_frames: List(String)
pub const half_circle_frames: List(String)
pub const moon_frames: List(String)
pub const negative_dots_frames: List(String)
pub const snake_frames: List(String)
pub const triangle_frames: List(String)
pub const walking_frames: List(String)

Functions

pub fn new(text: String) -> Builder

Start a spinner that runs concurrently in another Erlang process or JavaScript task.

pub fn set_colour(
  spinner: Spinner,
  colour: fn(String) -> String,
) -> Nil
pub fn set_text(spinner: Spinner, text: String) -> Nil
pub fn start(builder: Builder) -> Spinner
pub fn stop(spinner: Spinner) -> Nil

Stop the spinner, clearing the terminal line and showing the cursor. You may want to print a success message after this.

This should be called before your program ends to re-enable the terminal cursor.

pub fn with_colour(
  builder: Builder,
  colour: fn(String) -> String,
) -> Builder
pub fn with_frames(
  builder: Builder,
  frames: List(String),
) -> Builder
pub fn with_spinner(
  builder: Builder,
  context: fn(Spinner) -> a,
) -> Nil
Search Document