Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/src/resources/rmd/ojs.R
12921 views
1
ojs_define <- function(..., .session = shiny::getDefaultReactiveDomain()) {
2
quos <- rlang::enquos(...)
3
vars <- rlang::list2(...)
4
nm <- names(vars)
5
if (is.null(nm)) {
6
nm <- rep_len("", length(vars))
7
}
8
mapply(
9
function(q, nm, val) {
10
# Infer name, if possible
11
if (nm == "") {
12
tryCatch(
13
{
14
nm <- rlang::as_name(q)
15
},
16
error = function(e) {
17
code <- paste(collapse = "\n", deparse(rlang::f_rhs(q)))
18
stop(
19
"ojs_define() could not create a name for the argument: ",
20
code
21
)
22
}
23
)
24
}
25
.session$output[[nm]] <- val
26
outputOptions(.session$output, nm, suspendWhenHidden = FALSE)
27
.session$sendCustomMessage("ojs-export", list(name = nm))
28
NULL
29
},
30
quos,
31
nm,
32
vars,
33
SIMPLIFY = FALSE,
34
USE.NAMES = FALSE
35
)
36
invisible()
37
}
38
39