ExecEnvir | R Documentation |
where all the module functions are executed. It's rarely created
manually, use get_module
to create module, run with
start_app(m, test.mode=TRUE)
, and then inspect modules.
.__rave_context__.
context string for current instance, indicating whether the module is running locally (public, but internally used)
.__rave_package__.
current package name to run (public, but internally used)
.__rave_module__.
module ID (public, but internally used)
.__rave_module_instance__.
self instance (public, but internally used)
module_env
ModuleEnvir
instance
cache_env
cache environment to store key-value pairs locally
parent_env
the parent/top environment of the module, usually global environment or some name-space if the module is implemented as an R package
wrapper_env
stores all the utility functions. Some functions are
overridden there such as observe
,
rave_checks
, or eval_when_ready
. These functions behave
differently inside or outside of shiny context, and with or without data
loaded. The environment will be locked once the module is initialized.
The parent environment is parent_env
static_env
stores module static functions. These functions are
evaluated under parse_env
and then moved here. The environment
is locked after initialization. Its parent environment is
wrapper_env
param_env
stores parameters and most of the user inputs. It can
also serve as a repository for global variables. Unlike the previous
environments, param_env
is unlocked, but module creators do not
have access to this environment directly. The parent environment is
static_env
runtime_env
where the main part of module is running. All shiny
observe
and observeEvent
are
redirected to this environment by default (unless using
shiny::observe
). All functions in static_env
have access
to this environment. The parent environment is param_env
async_env
where asynchronous codes run
parse_env
environment where modules are parsed. The parent
environment is runtime_env
. Once all functions are evaluated,
this environment is not used. However, module creators don't directly
access this environment once the module is initialized.
ns
shiny name-space functions, is equivalent to
shiny::NS(module_id)
. The goal is to add prefixes to module inputs
so that two modules with the same input ID are named differently
auto_execute
(Deprecated) whether to auto-calculate results
manual_inputIds
character vector; name list of manually input IDs. Used when the algorithm takes long to run
rendering_inputIds
character vector; name list of input IDs that
when one of the corresponding inputs is changed, then rave_execute
will not get evaluated. Only the outputs are changed.
input_update
expressions to update inputs
register_output_events
expressions to register outputs
register_input_events
expressions to register inputs
execute
module main function. The function is dynamically generated. Don't call directly.
async_module
(experimental) whether the module contains any asynchronous part
global_reactives
shiny global reactives
, internal use only
local_reactives
shiny local reactives
, internal use only
internal_reactives
internal reactive values to control some elements, internal use only
ready_functions
functions to run when the module is ready. The
functions are called at the last step of shinirize
.
Usually it's used along with eval_when_ready
, to make sure
global_reactives
and local_reactives
getting registered
before functions calls
input_ids
vector of input IDs (read-only)
input_labels
vector of input labels (read-only)
output_labels
vector of output labels (read-only)
output_ids
vector of output IDs (read-only)
reload()
(experimental) signal the modules to reload
ExecEnvir$reload()
none
finalize()
garbage collection
ExecEnvir$finalize()
none
info()
print variables in different layers (environment)
ExecEnvir$info()
none
print()
print the memory address
ExecEnvir$print(...)
...
ignored
memory address
clean()
clean the environments to release the resource
ExecEnvir$clean()
none
new()
constructor
ExecEnvir$new(session = getDefaultReactiveDomain(), parent_env = NULL)
session
shiny session instance
parent_env
parent environment of this instance: package name space or global environment
reset()
reset the runtime environment, rarely used
ExecEnvir$reset(inputs)
inputs
reactive value list
none
copy()
(deprecated) copy the instance locally
ExecEnvir$copy( session_id = "__fake_runtime_env__", data_env = getDefaultDataRepository() )
session_id
character
data_env
where the data is stored, default is the environment
returned by getDefaultDataRepository
a copied instance
execute_with()
(deprecated) execute module with given parameter
ExecEnvir$execute_with(param, async = FALSE, plan = NULL)
param
named list
async
whether to run the whole module
plan
future plan
runtime environment
names()
returns names of a list, if names are null, returns blank characters
ExecEnvir$names(x)
x
a list
the names of the list
register_module()
register ModuleEnvir
instance
ExecEnvir$register_module(module_env)
module_env
ModuleEnvir
instance. The modules
are shared across different sessions, but to run the module, we need
to create runtime environment, which is ExecEnvir
none
register_context()
Register 'RAVE' context for current environment (internally used)
ExecEnvir$register_context(context = c("rave_running", "rave_running_local"))
context
context string to indicate whether the module is running locally
None
rave_inputs()
parse input components
ExecEnvir$rave_inputs( ..., .input_panels = list(), .tabsets = list(), .env = NULL, .manual_inputs = NULL, .render_inputs = NULL )
...
shiny input calls, such as textInput('id', 'Name', ...)
.input_panels, .tabsets
together define the input layouts
.env
ignored, debug only
.manual_inputs
input IDs that won't cause module re-calculate when inputs are updated
.render_inputs
input IDs that only trigger render functions when updated
none
rave_outputs()
parse output components
ExecEnvir$rave_outputs( ..., .output_tabsets = list(), .tabsets = list(), .env = NULL )
...
shiny output calls, such as plotOutput('id', 'Title')
.output_tabsets, .tabsets
together define the output layouts
.env
debug use
none
rave_updates()
input initialization when iEEG/ECoG
data are imported
ExecEnvir$rave_updates(..., .env = NULL)
...
R expressions
.env
for debug use
rave_execute()
parse, and compile to main function
ExecEnvir$rave_execute(..., auto = TRUE, .env = NULL, async_vars = NULL)
...
R expressions
auto
whether the module should run automatically
.env
debug use
async_vars
variables further passed to async
module
none, but ExecEnvir$execute
will be generated.
set_browser()
(experimental) cache R expression in browser
localStorage
ExecEnvir$set_browser(expr, session = getDefaultReactiveDomain())
expr
R expression
session
shiny session instance
generate_input_ui()
generate input panels according to parsed rave_inputs
ExecEnvir$generate_input_ui(sidebar_width = 3L)
sidebar_width
integer from 1 to 11, the width of the input panels
HTML tags
generate_output_ui()
generate outputs labels according to parsed
rave_outputs
ExecEnvir$generate_output_ui(sidebar_width = 3L)
sidebar_width
integer from 1 to 11, the width of the input panels,
the output panel width is calculated as 12-sidebar_width
HTML tags
is_global()
(deprecated) check if variable is shared across modules.
Please use cache_input
instead to get variable values.
ExecEnvir$is_global(inputId)
inputId
input ID
clone()
The objects of this class are cloneable with this method.
ExecEnvir$clone(deep = FALSE)
deep
Whether to make a deep clone.
Zhengjia Wang
## Not run:
# Load module
module <- get_module('ravebuiltins', 'power_explorer')
# Create execute environmen
execenv <- module$get_or_new_exec_env()
execenv$info()
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.