Debian Codegraph @

inst/examples/11_timer/app.R

raw
1 library(shiny)
2
3 # Define UI for displaying current time ----
4 ui <- fluidPage(
5
6 h2(textOutput("currentTime"))
7
8 )
9
10 # Define server logic to show current time, update every second ----
11 server <- function(input, output, session) {
12
13 output$currentTime <- renderText({
14 invalidateLater(1000, session)
15 paste("The current time is", Sys.time())
16 })
17
18 }
19
20 # Create Shiny app ----
21 shinyApp(ui, server)