mirror of
https://github.com/rstudio/shiny.git
synced 2026-01-10 23:48:01 -05:00
Use proper promise:: prefix
This commit is contained in:
@@ -165,7 +165,7 @@ drawPlot <- function(name, session, func, width, height, pixelratio, res, ...) {
|
||||
domain <- createGraphicsDevicePromiseDomain(device)
|
||||
grDevices::dev.control(displaylist = "enable")
|
||||
|
||||
p1 <- with_promise_domain(domain, {
|
||||
p1 <- promise::with_promise_domain(domain, {
|
||||
p2 <- promise::resolved(func())
|
||||
p2 <- promise::then(p2, function(value, visible) {
|
||||
if (visible) {
|
||||
|
||||
@@ -332,21 +332,19 @@ renderPrint <- function(expr, env = parent.frame(), quoted = FALSE,
|
||||
|
||||
renderFunc <- function(shinysession, name, ...) {
|
||||
domain <- createRenderPrintPromiseDomain(width)
|
||||
system2.5::with_promise_domain(domain, {
|
||||
p <- system2.5::Promise$new()$resolve(NULL)
|
||||
p2 <- p$then(
|
||||
function(value) func()
|
||||
p1 <- promise::with_promise_domain(domain, {
|
||||
p2 <- promise::resolved(func())
|
||||
p2 <- promise::then(p2, function(value) {
|
||||
res <- paste(readLines(domain$conn, warn = FALSE), collapse = "\n")
|
||||
res
|
||||
})
|
||||
# TODO jcheng 2017-04-11: Is this correct, or just leftover debugging?
|
||||
p2 <- promise::catch(p2,
|
||||
function(err) { cat(file=stderr(), "ERROR", err$message) }
|
||||
)
|
||||
})$then(function(value) {
|
||||
res <- paste(readLines(domain$conn, warn = FALSE), collapse = "\n")
|
||||
res
|
||||
})$catch(
|
||||
function(err) { cat(file=stderr(), "ERROR", err$message) }
|
||||
)$finally(
|
||||
function() {
|
||||
close(domain$conn)
|
||||
}
|
||||
)
|
||||
})
|
||||
p1 <- finally(p1, ~close(domain$conn))
|
||||
p1
|
||||
}
|
||||
|
||||
markRenderFunction(verbatimTextOutput, renderFunc, outputArgs = outputArgs)
|
||||
|
||||
@@ -2,4 +2,5 @@
|
||||
|
||||
- [x] How to handle invisible/withVisible? This is needed for dealing with ggplot2 in renderPlot.
|
||||
- [x] renderPlot is broken. plotFunc is synchronous but calls func() which is potentially asynchronous.
|
||||
- [ ] Brushing not working; the mapping is null for ggplot.
|
||||
- [ ] ..stacktraceon../..stacktraceoff.. and stack traces in general
|
||||
|
||||
Reference in New Issue
Block a user