Quellcode durchsuchen

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

shiny-input
Garrick Aden-Buie vor 6 Jahren
Ursprung
Commit
edfb9399ea
2 geänderte Dateien mit 8 neuen und 2 gelöschten Zeilen
  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 Datei anzeigen

@@ -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 Datei anzeigen

@@ -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

Laden…
Abbrechen
Speichern