unsetReactive-character-R6-method: Unset Reactive Object (character-r6)

Description Usage Arguments Value Author(s) References See Also Examples

Description

See generic: unsetReactive

Usage

1
2
## S4 method for signature 'character,R6'
unsetReactive(id, where = parent.frame(), ...)

Arguments

id

character.

where

R6.

...

Further arguments to be passed to subsequent functions/methods.

Value

logical. TRUE: success; FALSE: object was not a reactive one or failure to unset.

Author(s)

Janko Thyson janko.thyson@rappster.de

References

http://github.com/Rappster/reactr

See Also

Generic: unsetReactive, unsetReactiveByUid

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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
## Not run: 

##------------------------------------------------------------------------------  
## Non-strict get behavior //  
##------------------------------------------------------------------------------

## Set example reactive objects //  
setReactive(id = "x_1", value = 10)
setReactive(id = "x_2", value = function() "object-ref: {id: x_1}")

## Unset //
## --> transforms objects into non-reactive/regular objects again
isReactive("x_1")
unsetReactive("x_1")
isReactive("x_1")

## Inspect //
x_1
identical(x_2, x_1)
x_1 <- 20
x_1
x_2
## --> no reactive relationship to 'x_1' anymore; last cached value returned
isReactive("x_2")

## Reset referenced object again //
setReactive(id = "x_1", value = 50)
x_1
identical(x_2, x_1)
## --> reactive relationship re-established again

## Clean up //
rmReactive("x_1")
rmReactive("x_2")

##------------------------------------------------------------------------------  
## Strict get behavior level 1 //  
##------------------------------------------------------------------------------

setReactive(id = "x_1", value = 10)
setReactive(id = "x_2", value = function() "object-ref: {id: x_1}",
              strict_get = 1)
unsetReactive("x_1")

try(x_2)
## --> warning and NULL

setReactive(id = "x_1", value = 50)
x_2
## --> reactive relationship restored

## Clean up //
rmReactive("x_1")
rmReactive("x_2")

##------------------------------------------------------------------------------  
## Strict get behavior level 2 //  
##------------------------------------------------------------------------------

setReactive(id = "x_1", value = 10)
setReactive(id = "x_2", value = function() "object-ref: {id: x_1}",
              strict_get = 2)

unsetReactive("x_1")
try(x_2)
## --> error

setReactive(id = "x_1", value = 50)
x_2
## --> reactive relationship restored

## Clean up //
rmReactive("x_1")
rmReactive("x_2")


## End(Not run)

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