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.
Public fields
.__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
instancecache_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
, oreval_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 isparent_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 iswrapper_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 isstatic_env
runtime_env
where the main part of module is running. All shiny
observe
andobserveEvent
are redirected to this environment by default (unless usingshiny::observe
). All functions instatic_env
have access to this environment. The parent environment isparam_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 differentlyauto_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 onlylocal_reactives
shiny local
reactives
, internal use onlyinternal_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 witheval_when_ready
, to make sureglobal_reactives
andlocal_reactives
getting registered before functions calls
Active bindings
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)
Methods
Method print()
print the memory address
Method new()
constructor
Usage
ExecEnvir$new(session = getDefaultReactiveDomain(), parent_env = NULL)
Method copy()
(deprecated) copy the instance locally
Usage
ExecEnvir$copy(
session_id = "__fake_runtime_env__",
data_env = getDefaultDataRepository()
)
Arguments
session_id
character
data_env
where the data is stored, default is the environment returned by
getDefaultDataRepository
Method names()
returns names of a list, if names are null, returns blank characters
Method register_module()
register ModuleEnvir
instance
Arguments
module_env
ModuleEnvir
instance. The modules are shared across different sessions, but to run the module, we need to create runtime environment, which isExecEnvir
Method register_context()
Register 'RAVE' context for current environment (internally used)
Usage
ExecEnvir$register_context(context = c("rave_running", "rave_running_local"))
Method rave_inputs()
parse input components
Arguments
...
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
Method rave_outputs()
parse output components
Method rave_execute()
parse, and compile to main function
Method generate_output_ui()
generate outputs labels according to parsed
rave_outputs
Method is_global()
(deprecated) check if variable is shared across modules.
Please use cache_input
instead to get variable values.
Examples
if (FALSE) {
# Load module
module <- get_module('ravebuiltins', 'power_explorer')
# Create execute environmen
execenv <- module$get_or_new_exec_env()
execenv$info()
}