Skip to content

Instantly share code, notes, and snippets.

@bfatemi
Created April 4, 2019 01:54
Show Gist options
  • Save bfatemi/6aafaf6d65602c44e446b8786cba1bfc to your computer and use it in GitHub Desktop.
Save bfatemi/6aafaf6d65602c44e446b8786cba1bfc to your computer and use it in GitHub Desktop.
Loading page for shiny/R app implemented with the shinyjs R package.
library(shiny)
library(shinyjs)
load_data <- function() {
Sys.sleep(2)
hide("loading_page")
show("main_content")
}
ui <- fluidPage(
useShinyjs(),
div(
id = "loading_page",
h1("Loading...")
),
hidden(
div(
id = "main_content",
"Data loaded, content goes here"
)
)
)
server <- function(input, output, session) {
load_data()
}
shinyApp(ui = ui, server = server)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment