getDefaultReactiveDomain()withReactiveDomain(domain, expr)onReactiveDomainEnded(domain, callback, failIfNull = FALSE)
|domain||A valid domain object (for example, a Shiny session), or
|expr||An expression to evaluate under
|callback||A callback function to be invoked|
Reactive domains are a mechanism for establishing ownership over reactive primitives (like reactive expressions and observers), even if the set of reactive primitives is dynamically created. This is useful for lifetime management (i.e. destroying observers when the Shiny session that created them ends) and error handling.
At any given time, there can be either a single "default" reactive domain
object, or none (i.e. the reactive domain object is
NULL). You can
access the current default reactive domain by calling
Unless you specify otherwise, newly created observers and reactive
expressions will be assigned to the current default domain (if any). You can
override this assignment by providing an explicit
domain argument to
For advanced usage, it's possible to override the default domain using
domain argument will be made the
default domain while
expr is evaluated.
Implementers of new reactive primitives can use
as a convenience function for registering callbacks. If the reactive domain
FALSE, then the callback will
never be invoked.