Skip to content

Instantly share code, notes, and snippets.

@MayaGans
Last active January 26, 2020 15:53
Show Gist options
  • Save MayaGans/9c0395ad4a827ab0372acb57fdc846ac to your computer and use it in GitHub Desktop.
Save MayaGans/9c0395ad4a827ab0372acb57fdc846ac to your computer and use it in GitHub Desktop.
library(shiny)
# MODULE UI
customInputUI <- function(id) {
ns <- NS(id)
verbatimTextOutput(ns("debug"))
}
# MODULE SERVER
# Render the custom shiny input binding
customInput <- function(input, output, session) {
# This should return "This is a test" from script.js....?
output$debug <- renderPrint({ input$testing })
}
ui <- fixedPage(
h2("Shiny.setInputValue Inside Module"),
customInputUI("custom_input"),
# This is where we assign the custom binding
tags$script(src = "script.js")
)
server <- function(input, output, session) {
df <- callModule(customInput, "custom_input")
}
shinyApp(ui, server)
Shiny.setInputValue('test-testing', "This is a test");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment