Procházet zdrojové kódy

Refactor into resetTypingSpeed()

shiny-input
Garrick Aden-Buie před 6 roky
rodič
revize
644a8b6c2e
2 změnil soubory, kde provedl 11 přidání a 1 odebrání
  1. +5
    -1
      inst/shiny-input-app/app.R
  2. +6
    -0
      inst/shiny-input-app/dev-shiny-input.Rmd

+ 5
- 1
inst/shiny-input-app/app.R Zobrazit soubor

@@ -20,6 +20,10 @@ typingSpeedInput <- function(inputId, label, placeholder = NULL) {
)
}

resetTypingSpeed <- function(inputId, session = getDefaultReactiveDomain()) {
session$sendInputMessage("typing", TRUE)
}

ui <- fluidPage(
# textAreaInput("typing", "Type here..."),
typingSpeedInput("typing", "Type here..."),
@@ -31,7 +35,7 @@ server <- function(input, output, session) {
output$debug <- renderPrint(input$typing)

observeEvent(input$reset, {
session$sendInputMessage("typing", TRUE)
resetTypingSpeed("typing")
})
}


+ 6
- 0
inst/shiny-input-app/dev-shiny-input.Rmd Zobrazit soubor

@@ -473,3 +473,9 @@ to send `typing` a `TRUE`
whenever the button is clicked.

`r github_sha_link("269e4ebdc48a66ecf7466192076c4fa259582cc6")`

Once you get that working,
refactor it into a `resetTypingSpeed()` function.

This function should take an `inputId` and a `session` object.
Use `shiny::getDefaultReactiveDomain()` for the default `session` value.

Načítá se…
Zrušit
Uložit