Use proper promise:: prefix

This commit is contained in:
Joe Cheng
2017-04-11 16:59:48 -07:00
parent 74bf8b0554
commit 8c935ff44e
3 changed files with 14 additions and 15 deletions

View File

@@ -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) {

View File

@@ -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)

View File

@@ -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