# NOT RUN {
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())
})
}
)
}
# }
Run the code above in your browser using DataLab