Learn R Programming

waiter (version 0.1.3)

waitress: Waitress

Description

Programatically show and hide loading bars.

Usage

use_waitress(color = "#697682", percent_color = "#333333")

call_waitress( selector = NULL, theme = c("line", "overlay", "overlay-radius", "overlay-opacity", "overlay-percent"), min = 0, max = 100, infinite = FALSE )

browse_waitresses()

Arguments

color, percent_color

Color of waitress and color of percent text shown when theme is set to overlay-percent.

selector

Element selector to apply the waitress to, if NULL then the waitress is applied to the whole screen.

theme

A valid theme, see function usage.

min, max

Minimum and maximum representing the starting and ending points of the progress bar.

infinite

Set to TRUE to create a never ending loading bar, ideal when you cannot compute increments or assess the time it might take before the loading bar should be removed.

Details

You can pipe the methods with $. Waitress$new() and call_waitress() are equivalent.

Examples

Run this code
# NOT RUN {
library(shiny)

ui <- fluidPage(
  use_waitress("red"), # dependencies
  sliderInput("set", "percentage", 1, 100, step = 5, value = 1)
)

server <- function(input, output, session){
 
  w <- Waitress$
   new()$  # call a waitress
  	start() # start waitress
	 
  observeEvent(input$set, {
    w$set(input$set) # set at percentage
  })
}

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

Run the code above in your browser using DataLab