diff --git a/R/shinyModule.R b/R/shinyModule.R index 830dd1f..d8345d4 100644 --- a/R/shinyModule.R +++ b/R/shinyModule.R @@ -16,11 +16,7 @@ #' @rdname reactlog_module #' @export #' @examples -#' if (!require("shiny")) { -#' message("`shiny` required to run example") -#' return() -#' } -#' +#' if (requireNamespace("shiny", quietly = TRUE)) { #' library(shiny) #' # Enable reactlog #' reactlog_enable() @@ -55,6 +51,7 @@ #' if (interactive()) { #' shinyApp(ui = ui, server = server) #' } +#' } reactlog_module_ui <- function(include_refresh = TRUE, id = "reactlog_module") { ns <- shiny::NS(id) shiny::tagList( @@ -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 }) diff --git a/man/reactlog_module.Rd b/man/reactlog_module.Rd index 16dccf7..1e770b3 100644 --- a/man/reactlog_module.Rd +++ b/man/reactlog_module.Rd @@ -32,11 +32,7 @@ To open the reactlog at a particular step, be sure to mark your time points with \code{Cmd+Shift+F3} (Windows: \code{Ctrl+Shift+F3}) } \examples{ -if (!require("shiny")) { - message("`shiny` required to run example") - return() -} - +if (requireNamespace("shiny", quietly = TRUE)) { library(shiny) # Enable reactlog reactlog_enable() @@ -72,6 +68,7 @@ if (interactive()) { shinyApp(ui = ui, server = server) } } +} \seealso{ \code{\link[shiny:moduleServer]{shiny::moduleServer()}} }