Skip to contents

Variables set using Sys.setenv() are available to all users of a given Shiny app. This is not always desirable. shiny_setenv() allows you to set environment-like variables which are only available to the current user, but which are available within any Shiny module within the app.

Usage

shiny_setenv(..., session = shiny::getDefaultReactiveDomain())

Arguments

...

Named arguments with values coercible to a string.

session

A Shiny session object. Defaults to the current session.

Value

A logical vector of TRUE values the same length as ....

Examples

session <- rlang::env(userData = rlang::env())
shiny_setenv(foo = "bar", baz = "foo", session = session)
session$userData$foo
#> [1] "bar"
session$userData[["baz"]]
#> [1] "foo"