Debian Codegraph @

man/render_delayed.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/shiny.R
3 \name{render_delayed}
4 \alias{render_delayed}
5 \title{Delay Rendering for an Expression}
6 \usage{
7 render_delayed(expr)
8 }
9 \arguments{
10 \item{expr}{The expression to evaluate.}
11 }
12 \value{
13 An object representing the expression.
14 }
15 \description{
16 In a Shiny document, evaluate the given expression after the document has
17 finished rendering, instead of during render.
18 }
19 \details{
20 This function is useful inside Shiny documents. It delays the
21 evaluation of its argument until the document has finished its initial
22 render, so that the document can be viewed before the calculation is
23 finished.
24
25 Any expression that returns HTML can be wrapped in \code{render_delayed}.
26 }
27 \note{
28 \code{expr} is evaluated in a \strong{copy} of the environment in which
29 the \code{render_delayed} call appears. Consequently, no side effects
30 created by \code{expr} are visible in succeeding expressions, nor are
31 changes to the environment after the call to \code{render_delayed} visible
32 to \code{expr}.
33
34 \code{expr} must be an expression that produces HTML.
35 }
36 \examples{
37 \dontrun{
38 # Add the following code to an R Markdown document
39
40 div(Sys.time())
41
42 render_delayed({
43 Sys.sleep(3) # simulate an expensive computation
44 div(Sys.time())
45 })
46
47 div(Sys.time())
48 }
49 }