You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 line
758B

  1. library(shiny)
  2. typingSpeedInput <- function(inputId, label, placeholder = NULL) {
  3. .label <- label
  4. htmltools::withTags(
  5. div(
  6. class = "form-group typing-speed",
  7. label(class = "control-label", `for` = inputId, .label),
  8. textarea(id = inputId, class = "form-control", placeholder = placeholder),
  9. htmltools::htmlDependency(
  10. name = "typingSpeed",
  11. version = "0.0.1",
  12. src = ".",
  13. script = "typing.js",
  14. all_files = FALSE
  15. )
  16. )
  17. )
  18. }
  19. ui <- fluidPage(
  20. # textAreaInput("typing", "Type here..."),
  21. typingSpeedInput("typing", "Type here..."),
  22. verbatimTextOutput("debug")
  23. )
  24. server <- function(input, output, session) {
  25. output$debug <- renderPrint(input$typing)
  26. }
  27. shinyApp(ui, server)