Description Usage Arguments Value Examples
View source: R/snake_loader_function.R
Use the snake game to pass time during long running shiny operations.
1 2 | snake_loader(outputId, header = "Play Snake while you wait!",
controls = TRUE)
|
outputId |
The output id of the element that triggers the snake game loader; probably some output that takes a long time to load (or else there won't be time to play!) |
header |
The title to display over the game screen. |
controls |
Should text showing telling user to use the arrow keys appear below the game screen? |
A conditional panel that will load the snake game when the provided outputId
is recalculating
.
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 | ## Not run:
library(shiny)
library(snakeLoadR)
shinyApp(
shinyUI(
fluidPage(
fluidRow(
column(width=10, offset=1, algin="left",
actionButton("my_button", "Start Fake 30 Second Job"),
uiOutput("my_output"),
)
),
snakeLoadR::snake_loader(outputId = "my_output",
header = "Play Snake while you wait!",
controls = TRUE)
)
),
shinyServer(function(input, output) {
output$my_output <- renderUI({
if(input$my_button != 0) Sys.sleep(30)
HTML(paste0("<h3>Fake job completed <code>", input$my_button,"</code> times!</h3>"))
})
})
)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.