autoWaiter: Automatic Waiter

Description Usage Arguments Details Examples

View source: R/waiter.R

Description

This function allows easily adding waiters to dynamically rendered Shiny content where "dynamic" means render* and *output function pair.

Usage

1
autoWaiter(id = NULL, html = NULL, color = NULL, image = "", fadeout = FALSE)

Arguments

id

Vector of ids of elements to overlay the waiter. If NULL then the loading screens are applied to all elements.

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.

Details

This will display the waiter when the element is being recalculated and hide it when it receives new data.

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
25
26
27
28
29
library(shiny)
library(waiter)

ui <- fluidPage(
	autoWaiter(),
	actionButton(
		"trigger",
		"Render"
	),
	plotOutput("plot"),
	plotOutput("dom")
)

server <- function(input, output){
	output$plot <- renderPlot({
		input$trigger
		Sys.sleep(3)
		plot(cars)
	})

	output$dom <- renderPlot({
		input$trigger
		Sys.sleep(5)
		plot(runif(100))
	})
}

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

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