Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JohnCoene/waiter
🕰️ Loading screens for Shiny
https://github.com/JohnCoene/waiter
hacktoberfest r rstats shiny
Last synced: about 2 months ago
JSON representation
🕰️ Loading screens for Shiny
- Host: GitHub
- URL: https://github.com/JohnCoene/waiter
- Owner: JohnCoene
- License: other
- Created: 2019-03-08T09:09:17.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2024-04-12T07:01:17.000Z (8 months ago)
- Last Synced: 2024-10-15T00:51:46.255Z (about 2 months ago)
- Topics: hacktoberfest, r, rstats, shiny
- Language: JavaScript
- Homepage: https://waiter.john-coene.com/
- Size: 40.8 MB
- Stars: 498
- Watchers: 8
- Forks: 25
- Open Issues: 30
-
Metadata Files:
- Readme: README.Rmd
- Funding: FUNDING.yml
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
- awesome-starred - waiter - 🕰️ Loading screens for Shiny (CSS)
- awesome-shiny-extensions - waiter - Splash loading screens for Shiny. (UI Components / Loader)
- jimsghstars - JohnCoene/waiter - 🕰️ Loading screens for Shiny (JavaScript)
README
---
output:
github_document:
html_preview: false
---```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
Loading screens for Shiny
![R-CMD-check](https://github.com/JohnCoene/waiter/workflows/R-CMD-check/badge.svg)
[![CRAN status](https://www.r-pkg.org/badges/version/waiter)](https://CRAN.R-project.org/package=waiter)[Website](https://waiter.john-coene.com) | [Demo](https://shiny.john-coene.com/waiter/) | [Get Started](https://waiter.john-coene.com/#/waiter/intro) | [Cheat Sheet](https://waiter.john-coene.com/#/cheatsheet)
The waiter lets you programmatically show and hide partial or full page loading screens with spinners or loading bars to keep your users patiently waiting as you load or compute fancy things.
```{r, echo=FALSE, eval=TRUE}
yes <- ":heavy_check_mark:"
no <- ":heavy_multiplication_x:"feat <- tibble::tribble(
~"Feature", ~"Waiter", ~"Waitress", ~"Hostess", ~"Attendant",
"Progress Bar", yes, yes, yes, yes,
"Full Screen", yes, yes, no, no,
"Works with waiter", yes, no, yes, yes,
"Spinner", yes, no, no, no,
"Updatable", yes, no, no, yes,
"Notifications", no, yes, no, no
)knitr::kable(feat, align = "c")
```## Examples
Below are simple examples of applications that use the package, consult the [website](https://waiter.john-coene.com) for more.
## Waiter
To use the waiter:
1. Include `useWaiter` in your UI.
2. Trigger `waiter_show` to show the waiting screen.
3. Eventually trigger `waiter_hide` to hide the loading screen.```r
library(shiny)
library(waiter)ui <- fluidPage(
useWaiter(), # include dependencies
actionButton("show", "Show loading for 3 seconds")
)server <- function(input, output, session){
observeEvent(input$show, {
waiter_show( # show the waiter
html = spin_fading_circles() # use a spinner
)Sys.sleep(3) # do something that takes time
waiter_hide() # hide the waiter
})
}shinyApp(ui, server)
```![](man/figures//waiter-basic.gif)
The waiter includes more options to customise the spinner, the background, show the waiter on load, etc.
### Waitress
To use the waitress:
1. Include `use_waitress` in your UI.
2. Initialise a waitress from the `Waitress` object with the `new` method.
3. You must then call the `start`.
4. On the waitress object use the `increase` method to increase the progress bar.
5. Use the `hide` method when done.```r
library(shiny)
library(waiter)ui <- fluidPage(
useWaitress(),
p("App content")
)server <- function(input, output){
# call the waitress
waitress <- Waitress$
new(theme = "overlay-percent")$
start() # startfor(i in 1:10){
waitress$inc(10) # increase by 10%
Sys.sleep(.3)
}# hide when it's done
waitress$close()}
shinyApp(ui, server)
```![](man/figures//waitress-basic.gif)
There are more options to the waitress, you can have it overlay any element (such as the navbar), automagically increment it, etc.
## Get it
You can install waiter from [CRAN](https://CRAN.R-project.org/package=waiter).
```r
install.packages("waiter")
```Or the development version from Github with:
``` r
install.packages("remotes")
remotes::install_github("JohnCoene/waiter")
```Please note that the 'waiter' project is released with a [Contributor Code of Conduct](https://waiter.john-coene.com/#/coc). By contributing to this project, you agree to abide by its terms.