inst/examples/sandbox/server.R

library(shiny)
library(shinyjs)

source("helpers.R")

shinyServer(function(input, output, session) {
  # when an example is clicked, copy that expression to the input box
  lapply(names(examples), function(ex) {
    ex <- examples[ex]
    onclick(sprintf("example-%s", names(ex)),
            updateTextInput(session, "runcode_expr", value = as.character(ex)))
  })

  runcodeServer()
})

Try the shinyjs package in your browser

Any scripts or data that you put into this service are public.

shinyjs documentation built on Dec. 23, 2021, 5:06 p.m.