Skip to content

Commit

Permalink
Add session$userData feature (#1513)
Browse files Browse the repository at this point in the history
* Add session$userData

* Tweak wording of NEWS

* Fix broken links
  • Loading branch information
jcheng5 authored and wch committed Dec 15, 2016
1 parent 3c7f4b7 commit accd70d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
8 changes: 5 additions & 3 deletions NEWS.md
Expand Up @@ -15,15 +15,17 @@ shiny 0.14.2.9000

* Added ability through arguments to the `a` tag function called inside `downloadButton()` and `downloadLink()`. Closes [#986](https://github.com/rstudio/shiny/issues/986). ([#1492](https://github.com/rstudio/shiny/pulls/1492))

* Implemented [#1512](https://github.com/rstudio/shiny/issues/1512): added a `userData` environment to `session`, for storing arbitrary session-related variables. Generally, session-scoped variables are created just by declaring normal variables that are local to the Shiny server function, but `session$userData` may be more convenient for some advanced scenarios. ([#1513](https://github.com/rstudio/shiny/pull/1513))

### Bug fixes

* Fixed [#969](ttps://github.com/rstudio/shiny/issue/969): allow navbarPage's `fluid` param to control both containers. ([#1481](https://github.com/rstudio/shiny/pull/1481))
* Fixed [#969](https://github.com/rstudio/shiny/issues/969): allow navbarPage's `fluid` param to control both containers. ([#1481](https://github.com/rstudio/shiny/pull/1481))

* Fixed [#1438](https://github.com/rstudio/shiny/issue/1438): `unbindAll()` should not be called when inserting content with `insertUI()` ([#1449](https://github.com/rstudio/shiny/pull/1449))
* Fixed [#1438](https://github.com/rstudio/shiny/issues/1438): `unbindAll()` should not be called when inserting content with `insertUI()` ([#1449](https://github.com/rstudio/shiny/pull/1449))

* Fixed bug causing `<meta>` tags associated with HTML dependencies of Shiny R Markdown files to be rendered incorrectly. ([#1463](https://github.com/rstudio/shiny/pull/1463))

* Fixed [#1359](https://github.com/rstudio/shiny/issue/1359): `shinyApp()` options argument ignored when passed to `runApp()`. ([#1483](https://github.com/rstudio/shiny/pull/1483))
* Fixed [#1359](https://github.com/rstudio/shiny/issues/1359): `shinyApp()` options argument ignored when passed to `runApp()`. ([#1483](https://github.com/rstudio/shiny/pull/1483))

shiny 0.14.2
============
Expand Down
6 changes: 6 additions & 0 deletions R/shiny.R
Expand Up @@ -276,6 +276,10 @@ workerId <- local({
#' This is the request that was used to initiate the websocket connection
#' (as opposed to the request that downloaded the web page for the app).
#' }
#' \item{userData}{
#' An environment for app authors and module/package authors to store whatever
#' session-specific data they want.
#' }
#' \item{resetBrush(brushId)}{
#' Resets/clears the brush with the given \code{brushId}, if it exists on
#' any \code{imageOutput} or \code{plotOutput} in the app.
Expand Down Expand Up @@ -692,6 +696,7 @@ ShinySession <- R6Class(
closed = logical(0),
request = 'ANY', # Websocket request object
singletons = character(0), # Tracks singleton HTML fragments sent to the page
userData = 'environment',
user = NULL,
groups = NULL,

Expand All @@ -712,6 +717,7 @@ ShinySession <- R6Class(
self$progressStack <- Stack$new()
self$files <- Map$new()
self$downloads <- Map$new()
self$userData <- new.env(parent = emptyenv())

self$input <- .createReactiveValues(private$.input, readonly=TRUE)
.setLabel(self$input, 'input')
Expand Down
4 changes: 4 additions & 0 deletions man/session.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit accd70d

Please sign in to comment.