mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
Add a function to test whether the app is running
This commit is contained in:
11
R/globals.R
11
R/globals.R
@@ -1,6 +1,17 @@
|
||||
# A scope where we can put mutable global state
|
||||
.globals <- new.env(parent = emptyenv())
|
||||
|
||||
#' Check whether the Shiny app is running
|
||||
#'
|
||||
#' This function tests whether it is being called from within a running Shiny
|
||||
#' app.
|
||||
#' @return \code{TRUE} if the function is called from within a running Shiny
|
||||
#' app. 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
|
||||
|
||||
Reference in New Issue
Block a user