Debian Codegraph @

man/markRenderFunction.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/shinywrappers.R
3 \name{markRenderFunction}
4 \alias{markRenderFunction}
5 \title{Mark a function as a render function}
6 \usage{
7 markRenderFunction(
8 uiFunc,
9 renderFunc,
10 outputArgs = list(),
11 cacheHint = "auto",
12 cacheWriteHook = NULL,
13 cacheReadHook = NULL
14 )
15 }
16 \arguments{
17 \item{uiFunc}{A function that renders Shiny UI. Must take a single argument:
18 an output ID.}
19
20 \item{renderFunc}{A function that is suitable for assigning to a Shiny output
21 slot.}
22
23 \item{outputArgs}{A list of arguments to pass to the \code{uiFunc}. Render
24 functions should include \code{outputArgs = list()} in their own parameter list,
25 and pass through the value to \code{markRenderFunction}, to allow app authors to
26 customize outputs. (Currently, this is only supported for dynamically
27 generated UIs, such as those created by Shiny code snippets embedded in R
28 Markdown documents).}
29
30 \item{cacheHint}{One of \code{"auto"}, \code{FALSE}, or some other information to
31 identify this instance for caching using \code{\link[=bindCache]{bindCache()}}. If \code{"auto"}, it
32 will try to automatically infer caching information. If \code{FALSE}, do not
33 allow caching for the object. Some render functions (such as \link{renderPlot})
34 contain internal state that makes them unsuitable for caching.}
35
36 \item{cacheWriteHook}{Used if the render function is passed to \code{bindCache()}.
37 This is an optional callback function to invoke before saving the value
38 from the render function to the cache. This function must accept one
39 argument, the value returned from \code{renderFunc}, and should return the value
40 to store in the cache.}
41
42 \item{cacheReadHook}{Used if the render function is passed to \code{bindCache()}.
43 This is an optional callback function to invoke after reading a value from
44 the cache (if there is a cache hit). The function will be passed one
45 argument, the value retrieved from the cache. This can be useful when some
46 side effect needs to occur for a render function to behave correctly. For
47 example, some render functions call \code{\link[=createWebDependency]{createWebDependency()}} so that Shiny
48 is able to serve JS and CSS resources.}
49 }
50 \value{
51 The \code{renderFunc} function, with annotations.
52 }
53 \description{
54 \ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#superseded}{\figure{lifecycle-superseded.svg}{options: alt='[Superseded]'}}}{\strong{[Superseded]}} Please use \code{\link[=createRenderFunction]{createRenderFunction()}} to
55 support async execution. (Shiny 1.1.0)
56 }
57 \details{
58 Should be called by implementers of \code{renderXXX} functions in order to mark
59 their return values as Shiny render functions, and to provide a hint to Shiny
60 regarding what UI function is most commonly used with this type of render
61 function. This can be used in R Markdown documents to create complete output
62 widgets out of just the render function.
63
64 Note that it is generally preferable to use \code{\link[=createRenderFunction]{createRenderFunction()}} instead
65 of \code{markRenderFunction()}. It essentially wraps up the user-provided
66 expression in the \code{transform} function passed to it, then passes the resulting
67 function to \code{markRenderFunction()}. It also provides a simpler calling
68 interface. There may be cases where \code{markRenderFunction()} must be used instead of
69 \code{\link[=createRenderFunction]{createRenderFunction()}} -- for example, when the \code{transform} parameter of
70 \code{\link[=createRenderFunction]{createRenderFunction()}} is not flexible enough for your needs.
71 }
72 \seealso{
73 \code{\link[=createRenderFunction]{createRenderFunction()}}
74 }