resetTimer | R Documentation |
Reset shinyTimer
resetTimer(
inputId,
hours = 0,
minutes = 0,
seconds = 0,
session = shiny::getDefaultReactiveDomain()
)
inputId |
The input ID corresponding to the UI element. |
hours |
The new reset time in hours. |
minutes |
The new reset time in minutes. |
seconds |
The new reset time in seconds. |
session |
The session object from the shiny server function. |
No return value, called for side effects.
if (interactive()) {
library(shiny)
shinyApp(
ui = fluidPage(
shinyTimer("timer", label = "Countdown Timer", seconds = 20, type = "mm:ss"),
actionButton("reset", "Reset Timer")
),
server = function(input, output, session) {
observeEvent(input$reset, {
resetTimer("timer", seconds = 20)
})
}
)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.