Skip to content

Commit 14aee08

Browse files
committed
Add default update*Input function to input scaffold
1 parent 112ebb9 commit 14aee08

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

R/scaffold_input.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ scaffoldReactInput <- function(name, npmPkgs = NULL, edit = interactive()) {
2424
"boilerplate for input constructor",
2525
list(
2626
name = name,
27+
capName = capitalize(name),
2728
package = package
2829
)
2930
)

inst/templates/input_r.txt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,14 @@ ${name}Input <- function(inputId, default = "") {
2424
tags$span
2525
)
2626
}
27+
28+
#' <Add Title>
29+
#'
30+
#' <Add Description>
31+
#'
32+
#' @export
33+
update${capName}Input <- function(session, inputId, value, configuration = NULL) {
34+
message <- list(value = value)
35+
if (!is.null(configuration)) message$configuration <- configuration
36+
session$sendInputMessage(inputId, message);
37+
}

0 commit comments

Comments
 (0)