Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 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 @@ -20,11 +20,11 @@ Depends:
R (>= 3.0.2)
Imports:
jsonlite (>= 0.9.16),
rmarkdown,
Suggests:
shiny (>= 1.5.0),
fontawesome (>= 0.3.0),
knitr,
rmarkdown,
htmltools,
testthat
License: GPL-3 | file LICENSE
Expand Down
57 changes: 27 additions & 30 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 (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"),
#' # 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()
#' 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()
#' 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,13 +132,13 @@ shiny_version_required <- function() {
test_shiny_version <- function() {
tryCatch({
utils::packageVersion("shiny") >= shiny_version_required()
}, error = function() {
}, error = function(e) {
Comment thread
karangattu marked this conversation as resolved.
Outdated
# package not found
FALSE
})
}
assert_shiny_version <- function() {
if (!test_shiny_version()) {
stop("`shiny` v", shiny_version_required, " or greater must be installed")
stop("`shiny` v", shiny_version_required(), " or greater must be installed")
}
}
3 changes: 2 additions & 1 deletion bin/postinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

# do not create stubs from missing libraries
# ignore dev dependencies
yarn flow-typed install --skip true --ignoreDeps dev
# Allow flow-typed to fail (e.g. due to network issues fetching type defs from GitHub)
yarn flow-typed install --skip true --ignoreDeps dev || true

yarn build-only