rmReactive: Remove Reactive Object (generic)

Description Usage Arguments Details Implications with respect to observing variables Note Author(s) References See Also Examples

Description

Removes a reactive object from its environment. This implies that the registry (see getRegistry) is also updated accordingly.

Usage

1
rmReactive(id, where = parent.frame(), ...)

Arguments

id

Signature argument. Object containing path-like ID information.

where

Signature argument. Object containing location information.

...

Further arguments to be passed to subsequent functions/methods.

Details

Note that tis is different from unsetting a reactive object via rmReactive. It is equivalent to rm with a previous call to unsetReactive.

Implications with respect to observing variables

If other reactive variables have been observing the reactive variable that has been removed, from this point on they will simply return the last value that has been cached if when setting the object via setReactive argument strict was FALSE. In case it was TRUE, the function returns error condition BrokenReactiveBinding.

Note

The main S4 method is rmReactive-character-environment-method.

Author(s)

Janko Thyson janko.thyson@rappster.de

References

http://github.com/Rappster/reactr

See Also

rmReactive-character-environment-method

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
## Not run: 

## Start with fresh registry //
resetRegistry()

## Non-strict //
setReactive(id = "x_1", value = 10)
setReactive(id = "x_2", 
  value = function() {
    "object-ref: {id: x_1}"
    x_1 * 2
  }
)

rmReactive(id = "x_1")
exists("x_1", envir = environment(), inherits = FALSE)
x_2
## --> `x_2` not affected but only because `strict_get = 0`

## Strict: level 1 //
setReactive(id = "x_1", value = 10)
setReactive(id = "x_2", 
  value = function() {
    "object-ref: {id: x_1}"
    x_1 * 2
  },
  strict_get = 1
)
rmReactive(id = "x_1")
try(x_2)
## --> warning as referenced object `x_1` does not exist anymore

## Strict: level 2 //
setReactive(id = "x_1", value = 10)
setReactive(id = "x_2", 
  value = function() {
    "object-ref: {id: x_1}"
    x_1 * 2
  },
  strict_get = 2
)
rmReactive(id = "x_1")
try(x_2)
## --> error as referenced object `x_1` does not exist anymore


## End(Not run)

rappster/reactr documentation built on May 26, 2019, 11:56 p.m.