Examples for 'shinyjs::delay'


Execute R code after a specified number of milliseconds has elapsed

Aliases: delay

Keywords:

### ** Examples

if (interactive()) {
  library(shiny)
  shinyApp(
    ui = fluidPage(
      useShinyjs(),
      p(id = "text", "This text will disappear after 3 seconds"),
      actionButton("close", "Close the app in half a second")
    ),
    server = function(input, output) {
      delay(3000, hide("text"))
      observeEvent(input$close, {
        delay(500, stopApp())
      })
    }
  )
}
Attaching package: 'shiny'
The following object is masked from 'package:shinyjs':

    runExample
Error in loadNamespace(name): there is no package called 'webshot'

[Package shinyjs version 2.1.0 Index]