Debian Codegraph @

inst/examples-shiny/11_timer/app.R

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