I want to reset the reactive timer to zero and start counting to 10000 again.
If you press the reset button within 10s, "timer fires" should never print.
I thought this might work, but no.
require('shiny')
if (interactive()) {
ui <- fluidPage(
actionButton("reset_button", "Reset")
)
server <- function(input, output) {
autoInvalidate <- reactiveTimer(10000)
observe({
autoInvalidate()
print ("timer fires")
})
observeEvent(input$reset_button,
{
autoInvalidate <- reactiveTimer(10000)
print("reset")
}
)
}
shinyApp(ui, server)
}