Learn R Programming

waiter (version 0.0.6)

waitress: Waitress

Description

Programatically show and hide loading screens.

Usage

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

call_waitress( dom = NULL, theme = c("line", "overlay", "overlay-radius", "overlay-opacity", "overlay-percent") )

browse_waitresses()

Arguments

color, percent_color

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

dom

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.

Methods

Public methods

Method new()

Usage

Waitress$new(
  dom = NULL,
  theme = c("line", "overlay", "overlay-radius", "overlay-opacity", "overlay-percent")
)

Arguments

dom

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.

color, percent_color

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

Details

Create a waitress.

Examples

\dontrun{Waitress$new("#plot")}

Method start()

Usage

Waitress$start()

Details

Start the waitress.

Examples

\dontrun{Waitress$new("#plot")$start()}

Method set()

Usage

Waitress$set(percent)

Arguments

percent

Percentage to set waitress to.

Details

Set the waitress to a specific percentage.

Examples

\dontrun{Waitress$new("#plot")$set(20)}

Method auto()

Usage

Waitress$auto(percent, ms)

Arguments

percent

Percentage to set waitress to.

ms

Number of Milliseconds

Details

Automatically strat and end the waitress.

Examples

\dontrun{Waitress$new("#plot")$auto(20, 2000)}

Method increase()

Usage

Waitress$increase(percent)

Arguments

percent

Percentage to increase waitress to.

Details

Increase the waitress by a percentage.

Examples

\dontrun{Waitress$new("#plot")$increase(30)}

Method hide()

Usage

Waitress$hide()

Details

Hide the waitress.

Examples

\dontrun{Waitress$new("#plot")$hide()}

Method print()

Usage

Waitress$print()

Details

Print the waitress.

Examples

\dontrun{Waitress$new("#plot")$hide()}

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() #<U+00A0>start waitress
	 
  observeEvent(input$set, {
    w$set(input$set) # set at percentage
  })
}

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

## ------------------------------------------------
## Method `Waitress$new`
## ------------------------------------------------

# }
# NOT RUN {
Waitress$new("#plot")
# }
# NOT RUN {
## ------------------------------------------------
## Method `Waitress$start`
## ------------------------------------------------

# }
# NOT RUN {
Waitress$new("#plot")$start()
# }
# NOT RUN {
## ------------------------------------------------
## Method `Waitress$set`
## ------------------------------------------------

# }
# NOT RUN {
Waitress$new("#plot")$set(20)
# }
# NOT RUN {
## ------------------------------------------------
## Method `Waitress$auto`
## ------------------------------------------------

# }
# NOT RUN {
Waitress$new("#plot")$auto(20, 2000)
# }
# NOT RUN {
## ------------------------------------------------
## Method `Waitress$increase`
## ------------------------------------------------

# }
# NOT RUN {
Waitress$new("#plot")$increase(30)
# }
# NOT RUN {
## ------------------------------------------------
## Method `Waitress$hide`
## ------------------------------------------------

# }
# NOT RUN {
Waitress$new("#plot")$hide()
# }
# NOT RUN {
## ------------------------------------------------
## Method `Waitress$print`
## ------------------------------------------------

# }
# NOT RUN {
Waitress$new("#plot")$hide()
# }

Run the code above in your browser using DataLab