Files
shiny/R/sessioncontext.R
2013-12-13 14:46:31 -08:00

21 lines
647 B
R

# Keeps the context associated with a ShinySession reference object for the
# duration of a request. Used to emit reactive evaluation information to the
# appropriate session when showcase mode is enabled.
.sessionContext <- new.env(parent=emptyenv())
.beginShowcaseSessionContext <- function(session) {
assign("session", session, envir = .sessionContext)
}
.endShowcaseSessionContext <- function() {
if (exists("session", where = .sessionContext))
remove("session", envir = .sessionContext)
}
.getShowcaseSessionContext <- function() {
if (exists("session", where = .sessionContext))
.sessionContext$session
else
NULL
}