Skip to contents

Factory function that creates a waiter::Waiter instance pre-configured with Artalytics styling. Use this instead of creating Waiter objects directly to ensure consistent loading screens across modules.

Usage

create_waiter(html = NULL, fadeout = FALSE, color = "#f8efe7")

Arguments

html

Shiny tag. Loading screen HTML content. If NULL (default), uses wait_art_html()$html for themed artwork loading animation.

fadeout

Logical or numeric. If TRUE, fades out on hide. If numeric, specifies fade duration in milliseconds. Default: FALSE.

color

Character. Background color hex code. Default: "#f8efe7" (cream).

Value

A waiter::Waiter object ready for use with $show() and $hide().

Details

This factory standardizes waiter creation across the platform. Common patterns:

Configure once, show/hide:

w <- create_waiter(fadeout = TRUE)
w$show()
# ... do work ...
w$hide()

Update with different messages:

w <- create_waiter(fadeout = TRUE)
w$show()
w$update(html = wait_art_html(msg = "Step 1...")$html)
w$update(html = wait_art_html(msg = "Step 2...")$html)
w$hide()

See also

Examples

if (FALSE) { # \dontrun{
# Basic usage with defaults
w <- create_waiter(fadeout = TRUE)
w$show()
Sys.sleep(2)
w$hide()

# With custom message
w <- create_waiter(
  html = wait_art_html(msg = "Processing artwork...")$html,
  fadeout = TRUE
)
} # }