mirror of
https://github.com/rstudio/shiny.git
synced 2026-02-07 21:26:08 -05:00
Squashed commit of the following: commit 8667bed8962069a5cab8691f981e2b7ba9d449c3 Author: Winston Chang <winston@stdout.org> Date: Tue Jul 11 14:36:11 2017 -0500 Edits commitc4e8549ca5Author: Konrad Rudolph <konrad.rudolph@gmail.com> Date: Fri Jul 7 17:57:33 2017 +0100 Describe changes commit7b05c2e60fAuthor: Konrad Rudolph <konrad.rudolph@gmail.com> Date: Fri Jul 7 17:54:40 2017 +0100 Add new function to doc index commiteb93ebfad8Author: Konrad Rudolph <konrad.rudolph@gmail.com> Date: Fri Jul 7 17:54:30 2017 +0100 Add documentatio for new function commit1a6c8a4d72Author: Konrad Rudolph <konrad.rudolph@gmail.com> Date: Fri Jul 7 17:53:13 2017 +0100 Add a function to test whether the app is running
35 lines
1.2 KiB
R
35 lines
1.2 KiB
R
# A scope where we can put mutable global state
|
|
.globals <- new.env(parent = emptyenv())
|
|
|
|
#' Check whether a Shiny application is running
|
|
#'
|
|
#' This function tests whether a Shiny application is currently running.
|
|
#'
|
|
#' @return \code{TRUE} if a Shiny application is currently running. Otherwise,
|
|
#' \code{FALSE}.
|
|
#' @export
|
|
isRunning <- function() {
|
|
.globals$running
|
|
}
|
|
|
|
.onLoad <- function(libname, pkgname) {
|
|
# R's lazy-loading package scheme causes the private seed to be cached in the
|
|
# package itself, making our PRNG completely deterministic. This line resets
|
|
# the private seed during load.
|
|
withPrivateSeed(set.seed(NULL))
|
|
}
|
|
|
|
.onAttach <- function(libname, pkgname) {
|
|
# Check for htmlwidgets version, if installed. As of Shiny 0.12.0 and
|
|
# htmlwidgets 0.4, both packages switched from RJSONIO to jsonlite. Because of
|
|
# this change, Shiny 0.12.0 will work only with htmlwidgets >= 0.4, and vice
|
|
# versa.
|
|
if (system.file(package = "htmlwidgets") != "" &&
|
|
utils::packageVersion("htmlwidgets") < "0.4") {
|
|
packageStartupMessage(
|
|
"This version of Shiny is designed to work with htmlwidgets >= 0.4. ",
|
|
"Please upgrade your version of htmlwidgets."
|
|
)
|
|
}
|
|
}
|