add define observer to rLog

This commit is contained in:
Barret Schloerke
2018-12-14 12:05:37 -05:00
parent 0f13056aa2
commit 1b06bab7ee
2 changed files with 4 additions and 1 deletions

View File

@@ -221,6 +221,9 @@ RLog <- R6Class(
defineKey = function(reactId, value, key, label, domain) {
self$define(self$keyIdStr(reactId, key), value, self$keyIdStr(label, key), "reactiveValuesKey", domain)
},
defineObserver = function(reactId, label, domain) {
self$define(reactId, value = NULL, label, "observer", domain)
},
dependsOn = function(reactId, depOnReactId, ctxId, domain) {
if (is.null(reactId)) return()

View File

@@ -1082,7 +1082,7 @@ Observer <- R6Class(
setAutoDestroy(autoDestroy)
.reactId <<- nextGlobalReactId()
rLog$define(.reactId, NULL, .label, type = "observer", .domain)
rLog$defineObserver(.reactId, .label, .domain)
# Defer the first running of this until flushReact is called
.createContext()$invalidate()