Explorar el Código

Update .getValue() - return both as object/list

shiny-input
Garrick Aden-Buie hace 6 años
padre
commit
edfb9399ea
Se han modificado 2 ficheros con 8 adiciones y 2 borrados
  1. +4
    -1
      inst/shiny-input-app/dev-shiny-input.Rmd
  2. +4
    -1
      inst/shiny-input-app/typing.js

+ 4
- 1
inst/shiny-input-app/dev-shiny-input.Rmd Ver fichero

@@ -332,4 +332,7 @@ Update `.getValue()` to

1. Return the number of characters the user has typed (`r github_sha_link("b3958d5e3f60fbac3a0100673696bd413a276fb4")`)

1. Return the number of words the user has entered
1. Return the number of words the user has entered (`r github_sha_link("e3fa485bb60853e391302289213d3cd5f0846b3e")`)

1. Create variables for both number of characters and words and return both
in an object

+ 4
- 1
inst/shiny-input-app/typing.js Ver fichero

@@ -16,7 +16,10 @@ $.extend(typingSpeed, {
// your input. In this function, find or construct the value that will be
// returned to Shiny. The ID of `el` is used for the inputId.

return el.value.split(' ').length;
const nchar = el.value.length;
const nword = el.value.split(' ').length;

return {nchar, nword};
},
setValue: function(el, value) {
// This method is used for restoring the bookmarked state of your input

Cargando…
Cancelar
Guardar