waiter: Waiter

Description Usage Arguments Functions Examples

Description

Programatically show and hide loading screens.

Usage

 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
30
31
32
33
34
35
36
37
use_waiter(spinners = 1:7, include_js = TRUE)

waiter_use(spinners = 1:7, include_js = TRUE)

show_waiter(
  html = "",
  color = "#333e48",
  logo = "",
  id = NULL,
  hide_on_render = FALSE
)

waiter_show(
  id = NULL,
  html = spin_1(),
  color = "#333e48",
  logo = "",
  hide_on_render = !is.null(id)
)

show_waiter_on_load(html = "", color = "#333e48", logo = "")

waiter_show_on_load(html = spin_1(), color = "#333e48", logo = "")

hide_waiter_on_drawn(id)

waiter_hide_on_render(id)

waiter_on_busy(html = spin_1(), color = "#333e48", logo = "")

hide_waiter(id = NULL)

waiter_hide(id = NULL)

update_waiter(html = "", id = NULL)

waiter_update(id = NULL, html = NULL)

Arguments

spinners

Spinners to include. By default all the CSS files for all spinners are included you can customise this only that which you need in order to reduce the amount of CSS that needs to be loaded and improve page loading speed. There are 7 spinner kits. The spinner kit required for the spinner you use is printed in the R console when using the spinner. You can specify a single spinner kit e.g.: 1 or multiple spinner kits as a vector e.g.: c(1,3,6).

include_js

Deprecated argument, no longer needed.

html

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

color

Background color of loading screen.

logo

Logo to display.

id

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

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.

Functions

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)

ui <- fluidPage(
  use_waiter(), # dependencies
  waiter_show_on_load(spin_fading_circles()), # shows before anything else 
  actionButton("show", "Show loading for 5 seconds")
)

server <- function(input, output, session){
  waiter_hide() # will hide *on_load waiter
  
  observeEvent(input$show, {
    waiter_show(
      html = tagList(
        spin_fading_circles(),
        "Loading ..."
      )
    )
    Sys.sleep(3)
    waiter_hide()
  })
}

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

waiter documentation built on July 12, 2020, 5:05 p.m.