Displays an iframe of the reactlog in the given application.

reactlog_module_ui(include_refresh = TRUE, id = "reactlog_module")

reactlog_module_server(
  id = "reactlog_module",
  width = "100%",
  height = 600,
  ...
)

Arguments

include_refresh

should the iframe refresh button be included?

id

shiny module id to use

width, height

HTML attributes to be applied to the reactlog iframe

...

parameters passed to shiny::actionButton()

Details

State will not be preserved between refreshes. To open the reactlog at a particular step, be sure to mark your time points with Cmd+Shift+F3 (Windows: Ctrl+Shift+F3)

Examples

if (requireNamespace("shiny", quietly = TRUE)) {
  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
  )

  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()
    })

  ### start server module
    reactlog_module_server()
  ### end server module

  }

  if (interactive()) {
    shinyApp(ui = ui, server = server)
  }
}