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_envModuleEnvirinstancecache_envcache environment to store key-value pairs locally
parent_envthe parent/top environment of the module, usually global environment or some name-space if the module is implemented as an R package
wrapper_envstores 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_envstatic_envstores module static functions. These functions are evaluated under
parse_envand then moved here. The environment is locked after initialization. Its parent environment iswrapper_envparam_envstores parameters and most of the user inputs. It can also serve as a repository for global variables. Unlike the previous environments,
param_envis unlocked, but module creators do not have access to this environment directly. The parent environment isstatic_envruntime_envwhere the main part of module is running. All shiny
observeandobserveEventare redirected to this environment by default (unless usingshiny::observe). All functions instatic_envhave access to this environment. The parent environment isparam_envasync_envwhere asynchronous codes run
parse_envenvironment 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.nsshiny 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_inputIdscharacter vector; name list of manually input IDs. Used when the algorithm takes long to run
rendering_inputIdscharacter vector; name list of input IDs that when one of the corresponding inputs is changed, then
rave_executewill not get evaluated. Only the outputs are changed.input_updateexpressions to update inputs
register_output_eventsexpressions to register outputs
register_input_eventsexpressions to register inputs
executemodule main function. The function is dynamically generated. Don't call directly.
async_module(experimental) whether the module contains any asynchronous part
global_reactivesshiny global
reactives, internal use onlylocal_reactivesshiny local
reactives, internal use onlyinternal_reactivesinternal reactive values to control some elements, internal use only
ready_functionsfunctions 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_reactivesandlocal_reactivesgetting registered before functions calls
Active bindings
input_idsvector of input IDs (read-only)
input_labelsvector of input labels (read-only)
output_labelsvector of output labels (read-only)
output_idsvector 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_idcharacter
data_envwhere 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_envModuleEnvirinstance. 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, .tabsetstogether define the input layouts
.envignored, debug only
.manual_inputsinput IDs that won't cause module re-calculate when inputs are updated
.render_inputsinput 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) { # \dontrun{
# Load module
module <- get_module('ravebuiltins', 'power_explorer')
# Create execute environmen
execenv <- module$get_or_new_exec_env()
execenv$info()
} # }