mirror of
https://github.com/rstudio/shiny.git
synced 2026-04-07 03:00:20 -04:00
Remove onInvalidateHint
The recent changes to onInvalidate make it do almost exactly the same thing.
This commit is contained in:
16
R/react.R
16
R/react.R
@@ -5,8 +5,7 @@ Context <- setRefClass(
|
||||
.label = 'character', # For debug purposes
|
||||
.invalidated = 'logical',
|
||||
.invalidateCallbacks = 'list',
|
||||
.flushCallbacks = 'list',
|
||||
.hintCallbacks = 'list'
|
||||
.flushCallbacks = 'list'
|
||||
),
|
||||
methods = list(
|
||||
initialize = function(label=NULL) {
|
||||
@@ -14,7 +13,6 @@ Context <- setRefClass(
|
||||
.invalidated <<- FALSE
|
||||
.invalidateCallbacks <<- list()
|
||||
.flushCallbacks <<- list()
|
||||
.hintCallbacks <<- list()
|
||||
.label <<- label
|
||||
},
|
||||
run = function(func) {
|
||||
@@ -22,15 +20,6 @@ Context <- setRefClass(
|
||||
env <- .getReactiveEnvironment()
|
||||
env$runWith(.self, func)
|
||||
},
|
||||
invalidateHint = function() {
|
||||
"Let this context know it may or may not be invalidated very soon; that
|
||||
is, something in its dependency graph has been invalidated but there's no
|
||||
guarantee that the cascade of invalidations will reach all the way here.
|
||||
This is used to show progress in the UI."
|
||||
lapply(.hintCallbacks, function(func) {
|
||||
func()
|
||||
})
|
||||
},
|
||||
invalidate = function() {
|
||||
"Invalidate this context. It will immediately call the callbacks
|
||||
that have been registered with onInvalidate()."
|
||||
@@ -62,9 +51,6 @@ Context <- setRefClass(
|
||||
"Register a function to be called when this context is flushed."
|
||||
.flushCallbacks <<- c(.flushCallbacks, func)
|
||||
},
|
||||
onInvalidateHint = function(func) {
|
||||
.hintCallbacks <<- c(.hintCallbacks, func)
|
||||
},
|
||||
executeFlushCallbacks = function() {
|
||||
"For internal use only."
|
||||
lapply(.flushCallbacks, function(func) {
|
||||
|
||||
@@ -17,19 +17,10 @@ Dependencies <- setRefClass(
|
||||
lapply(
|
||||
.dependencies$values(),
|
||||
function(ctx) {
|
||||
ctx$invalidateHint()
|
||||
ctx$invalidate()
|
||||
NULL
|
||||
}
|
||||
)
|
||||
},
|
||||
invalidateHint = function() {
|
||||
lapply(
|
||||
.dependencies$values(),
|
||||
function(dep.ctx) {
|
||||
dep.ctx$invalidateHint()
|
||||
NULL
|
||||
})
|
||||
}
|
||||
)
|
||||
)
|
||||
@@ -133,7 +124,6 @@ Values <- setRefClass(
|
||||
lapply(
|
||||
mget(dep.keys, envir=.dependencies),
|
||||
function(ctx) {
|
||||
ctx$invalidateHint()
|
||||
ctx$invalidate()
|
||||
NULL
|
||||
}
|
||||
@@ -225,9 +215,6 @@ Observable <- setRefClass(
|
||||
.dirty <<- TRUE
|
||||
.dependencies$invalidate()
|
||||
})
|
||||
ctx$onInvalidateHint(function() {
|
||||
.dependencies$invalidateHint()
|
||||
})
|
||||
.execCount <<- .execCount + 1L
|
||||
ctx$run(function() {
|
||||
.value <<- try(.func(), silent=FALSE)
|
||||
@@ -286,7 +273,6 @@ Observer <- setRefClass(
|
||||
fields = list(
|
||||
.func = 'function',
|
||||
.label = 'character',
|
||||
.hintCallbacks = 'list',
|
||||
.execCount = 'integer'
|
||||
),
|
||||
methods = list(
|
||||
@@ -311,20 +297,11 @@ Observer <- setRefClass(
|
||||
ctx$onInvalidate(function() {
|
||||
ctx$addPendingFlush()
|
||||
})
|
||||
ctx$onInvalidateHint(function() {
|
||||
lapply(.hintCallbacks, function(func) {
|
||||
func()
|
||||
NULL
|
||||
})
|
||||
})
|
||||
ctx$onFlush(function() {
|
||||
run()
|
||||
})
|
||||
.execCount <<- .execCount + 1L
|
||||
ctx$run(.func)
|
||||
},
|
||||
onInvalidateHint = function(func) {
|
||||
.hintCallbacks <<- c(.hintCallbacks, func)
|
||||
}
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user