I updated my answer based on the comment below. Here I used a 0.2 second time difference threshold to distinguish between a double clock and a normal click. In my application, I used a slightly different approach. I just check how many times the button is pressed, checking if it is divisible by 2 or not.
library(shiny) t1 <<- Sys.time() ui =fluidPage( actionButton("my_button", "Dont Touch it!"), mainPanel(textOutput("x")) ) server = function(input, output, session){ my_data <- reactive({ if(input$my_button == 0) { return() } if(input$my_button%%2!=0) { t1 <<- Sys.time() } if(input$my_button%%2==0 & (Sys.time() - t1 <= 0.2)) { "You pushed the button twice!" } }) output$x <- renderText({my_data()}) } runApp(list(ui = ui, server = server))
source share