These functions allow to pause and unpause keyboard watching
pauseKey(session = shiny::getDefaultReactiveDomain())
unpauseKey(session = shiny::getDefaultReactiveDomain())
The session
object passed to function given to
shinyServer
. Default is getDefaultReactiveDomain()
.
if (interactive()){
library(shiny)
ui <- fluidPage(
useKeys(),
keysInput("keys", letters),
actionButton("pause", "Pause"),
actionButton("unpause", "Unpause")
)
server <- function(input, output, session) {
observeEvent(input$keys, {
print(input$keys)
})
observeEvent(input$pause, {
pauseKey()
})
observeEvent(input$unpause, {
unpauseKey()
})
}
shinyApp(ui, server)
}