# NOT RUN {
if (interactive()) {
library(shiny)
ui <- fluidPage(
title = "Initial Title",
use_shiny_title(),
actionButton("button", "Click me for a 10 second flashing title"),
actionButton("button2", "Click me for a delayed flashing button")
)
server <- function(input, output, session) {
observeEvent(input$button, {
flashing_window_title(
session, "--- Flash ---", revert_on_mousemove = FALSE, duration = 10000
)
})
observeEvent(input$button2, {
Sys.sleep(3)
flashing_window_title(
session, "Please Come Back", inactive_only = TRUE, interval = 1000
)
})
}
shinyApp(ui, server)
}
# }
Run the code above in your browser using DataLab