# NOT RUN {
if (interactive()) {
library(shiny)
ui <- fluidPage(
title = "Initial Title",
use_shiny_title(),
actionButton("button", "Click me for a new title"),
actionButton("button2", "Click me for a button when finished")
)
server <- function(input, output, session) {
observeEvent(input$button, {
change_window_title(session, "New Title")
})
observeEvent(input$button2, {
Sys.sleep(3)
change_window_title(session, "Sleep Finished", inactive_only = TRUE)
})
}
shinyApp(ui, server)
}
# }
Run the code above in your browser using DataLab