computeObjectUid: Compute Object UID (generic)

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

View source: R/computeObjectUid.r

Description

Computes the UID of an object based on its name/ID (id) and the environment where it has been assigned to (where).

Usage

1

Arguments

id

character. Name of the reactive object.

where

environment. Environment to create the object in.

...

Further arguments to be passed to subsequent functions/methods.

Value

character. Object UID (checksum).

Author(s)

Janko Thyson janko.thyson@rappster.de

References

http://github.com/Rappster/reactr

See Also

setReactive

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
## Not run: 

##------------------------------------------------------------------------------
## W/o explicit 'where' //
##------------------------------------------------------------------------------

id_1 <- "x_1"
id_2 <- "x_2"

setReactive(id = id_1, value = 10)
setReactive(id = id_2, value = function() {
  .ref_1 <- get(x = id_1)
})
x_1
x_2

uid_1 <- computeObjectUid(id = id_1)
uid_1
uid_2 <- computeObjectUid(id = id_2)
uid_2

## If these UIDs are available in the registry, they are correct //
registry <- getRegistry()
exists(uid_1, registry)
exists(uid_2, registry)

## Clean up //
rm(x_1)
rm(x_2)
resetRegistry()

##------------------------------------------------------------------------------
## With explicit 'where' //
##------------------------------------------------------------------------------

id_1 <- "x_1"
id_2 <- "x_2"
where <- new.env()

setReactive(id = id_1, value = 10, where = where)
setReactive(id = id_2, value = function() {
  .ref_1 <- get(x = id_1)
}, where = where)
where$x_1
where$x_2

uid_1 <- computeObjectUid(id = id_1, where = where)
uid_1
uid_2 <- computeObjectUid(id = id_2, where = where)
uid_2

## If these UIDs are available in the registry, they are correct //
registry <- getRegistry()
exists(uid_1, registry)
exists(uid_2, registry)

## Clean up //
rm(where)
resetRegistry()


## End(Not run)

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