triggerWaiter: Trigger Waiter

Description Usage Arguments Examples

View source: R/waiter.R

Description

A a trigger to a waiting screen from the UI.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
triggerWaiter(
  el,
  id = NULL,
  html = NULL,
  color = NULL,
  image = "",
  fadeout = FALSE,
  on = "click",
  hide_on_render = !is.null(id),
  hide_on_error = !is.null(id),
  hide_on_silent_error = !is.null(id)
)

Arguments

el

Element that triggers the waiter.

id

Id of element to hide or element on which to show waiter over.

html

HTML content of waiter, generally a spinner, see spinners.

color

Background color of loading screen.

image

Path to background image.

fadeout

Use a fade out effect when the screen is removed. Can be a boolean, or a numeric indicating the number of milliseconds the effect should take.

on

The event that triggers the waiter.

hide_on_render

Set to TRUE to automatically hide the waiter when the plot in id is drawn. Note the latter will only work with shiny plots, tables, htmlwidgets, etc. but will not work with arbitrary elements.

hide_on_error, hide_on_silent_error

Whether to hide the waiter when the underlying element throws an error. Silent error are thrown by req and validate.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
library(shiny)
library(waiter)

ui <- fluidPage(
 useWaiter(),
 triggerWaiter(
   actionButton(
     "generate",
     "Generate Plot"
   )
 ),
 plotOutput("plot")
)

server <- function(input, output){
 output$plot <- renderPlot({
   input$generate
   Sys.sleep(3)
   plot(runif(50))
 })
}

if(interactive())
 shinyApp(ui, server)

waiter documentation built on Jan. 3, 2022, 5:13 p.m.