Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ Encoding: UTF-8
RoxygenNote: 7.2.1
URL: https://rstudio.github.io/reactlog/, https://github.com/rstudio/reactlog, https://community.rstudio.com/tag/reactlog
BugReports: https://github.com/rstudio/reactlog/issues
VignetteBuilder: knitr
VignetteBuilder: knitr, rmarkdown
Language: en-US
Roxygen: list(markdown = TRUE)
63 changes: 30 additions & 33 deletions R/shinyModule.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,44 +16,41 @@
#' @rdname reactlog_module
#' @export
#' @examples
#' if (!require("shiny")) {
#' message("`shiny` required to run example")
#' return()
#' }
#'
#' library(shiny)
#' # Enable reactlog
#' reactlog_enable()
#' if (require("shiny")) {
#' library(shiny)
#' # Enable reactlog
#' reactlog_enable()
#'
#' # Define UI for app that draws a histogram ----
#' ui <- fluidPage(
#' tags$h1("Pythagorean theorem"),
#' numericInput("a", "A", 3),
#' numericInput("b", "B", 4),
#' "C:", verbatimTextOutput("c"),
#' ### start ui module
#' reactlog_module_ui()
#' ### end ui module
#' )
#' # Define UI for app that draws a histogram ----
#' ui <- fluidPage(
#' tags$h1("Pythagorean theorem"),
#' numericInput("a", "A", 3),
#' numericInput("b", "B", 4),
#' "C:", verbatimTextOutput("c"),
#' ### start ui module
#' reactlog_module_ui()
#' ### end ui module
#' )
#'
#' server <- function(input, output, session) {
#' a2 <- reactive({a <- input$a; req(a); a * a}, label = "a^2")
#' b2 <- reactive({b <- input$b; req(b); b * b}, label = "b^2")
#' c2 <- reactive({a2() + b2()}, label = "c^2")
#' c_val <- reactive({sqrt(c2())}, label = "c")
#' server <- function(input, output, session) {
#' a2 <- reactive({a <- input$a; req(a); a * a}, label = "a^2")
#' b2 <- reactive({b <- input$b; req(b); b * b}, label = "b^2")
#' c2 <- reactive({a2() + b2()}, label = "c^2")
#' c_val <- reactive({sqrt(c2())}, label = "c")
#'
#' output$c <- renderText({
#' c_val()
#' })
#' output$c <- renderText({
#' c_val()
#' })
#'
#' ### start server module
#' reactlog_module_server()
#' ### end server module
#' ### start server module
#' reactlog_module_server()
#' ### end server module
#'
#' }
#' }
#'
#' if (interactive()) {
#' shinyApp(ui = ui, server = server)
#' if (interactive()) {
#' shinyApp(ui = ui, server = server)
#' }
#' }
reactlog_module_ui <- function(include_refresh = TRUE, id = "reactlog_module") {
ns <- shiny::NS(id)
Expand Down Expand Up @@ -135,7 +132,7 @@ shiny_version_required <- function() {
test_shiny_version <- function() {
tryCatch({
utils::packageVersion("shiny") >= shiny_version_required()
}, error = function() {
}, error = function(e) {
# package not found
FALSE
})
Expand Down