recordKeys: Create a keys recorder input control

Description Usage Arguments Examples

View source: R/record.R

Description

Create a key input that can be used to record keys pressed by the user.

Usage

1
2
3
keysRecordInput(inputId)

recordKeys(inputId, session = shiny::getDefaultReactiveDomain())

Arguments

inputId

The input slot that will be used to access the value.

session

The session object passed to function given to shinyServer. Default is getDefaultReactiveDomain().

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
if (interactive()) {
  library(shiny)

  ui <- fluidPage(
    useKeys(),
    keysRecordInput("recorder"),
    keysInput("keys", "command+shift+k"),
    actionButton("record", "Record keys")
  )

  server <- function(input, output, session) {
    observeEvent(input$record, {
      print("recording keys...")
      recordKeys("recorder")
    })
    observeEvent(input$recorder, {
      print("adding keys...")
      addKeys("keys", input$recorder)
    })
    observeEvent(input$keys, {
      print(input$keys)
    })
  }

  shinyApp(ui, server)
}

keys documentation built on July 12, 2021, 1:05 a.m.