suppressMessages(require("reactr"))

Reactive objects (focus visible part)

Example objects

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

Compute object UID

computeObjectUid(id = "x_1")
computeObjectUid(id = "x_2")

Copy reactive objects

copyReactive(id_from = "x_1", id_to = "x_1_copy")
x_1_copy

Get reactive

getReactive(id = "x_1")
getReactive(id = "x_1", hidden = TRUE)
getReactive(id = "x_2")

Is reactive

isReactive(id = "x_1")
isReactive(id = "x_2")
x_3 <- "hello world!"
isReactive(id = "x_3")

Unset reactive

unsetReactive(id = "x_1")
isReactive(id = "x_1")

Removing reactive

rmReactive(id = "x_1")
exists("x_1")
## --> already unset
rmReactive(id = "x_2")
exists("x_2")

Reactive objects (focus invisible part)

Example objects

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

Get binding function

getBinding(id = "x_1")
getBinding(id = "x_2")

Get checksum of visible value

getChecksum(id = "x_1")
getChecksum(id = "x_2")

Get reactive

getReactive(id = "x_1", hidden = TRUE)
getReactive(id = "x_2", hidden = TRUE)

Show pull references

showPullRefs(id = "x_1")
showPullRefs(id = "x_2")

Show push references

showPushRefs(id = "x_1")
showPushRefs(id = "x_2")

setReactive(id = "x_2", value = function() {
  "object-ref: {id: x_1}"
  x_1 * 2
}, push = TRUE)
showPushRefs(id = "x_2")

Clean up

rmReactive("x_1")
rmReactive("x_2")

Registry

Example objects

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

Get registry

reg <- getRegistry()
ls(reg)

Show registry

showRegistry()

Get from registry

getFromRegistry(id = "x_1")
getFromRegistry(id = "x_2")

getFromRegistryByUid(computeObjectUid("x_1"))
getFromRegistryByUid(computeObjectUid("x_2"))

Remove from registry

computeObjectUid("x_1") %in% showRegistry()
rmFromRegistry("x_1")
computeObjectUid("x_1") %in% showRegistry()

computeObjectUid("x_2") %in% showRegistry()
rmFromRegistryByUid(computeObjectUid("x_2"))
computeObjectUid("x_2") %in% showRegistry()

Reset registry

## Ensure content that might previously have been removed //
setReactive(id = "x_1", value = 10)
setReactive(id = "x_2", value = function() "object-ref: {id: x_1}")

## Reset //
showRegistry()
resetRegistry()
showRegistry()


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