File: app-state.R

package info (click to toggle)
r-cran-shiny 1.10.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,948 kB
  • sloc: javascript: 39,934; sh: 28; makefile: 20
file content (26 lines) | stat: -rw-r--r-- 701 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#' @include globals.R
NULL

# The current app state is a place to read and hang state for the
# currently-running application. This is useful for setting options that will
# last as long as the application is running.

.globals$appState <- NULL

initCurrentAppState <- function(appobj) {
  if (!is.null(.globals$appState)) {
    stop("Can't initialize current app state when another is currently active.")
  }
  .globals$appState <- new.env(parent = emptyenv())
  .globals$appState$app <- appobj
  # Copy over global options
  .globals$appState$options <- .globals$options
}

getCurrentAppState <- function() {
  .globals$appState
}

clearCurrentAppState <- function() {
  .globals$appState <- NULL
}