Debian Codegraph @

man/MockShinySession.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/mock-session.R
3 \name{MockShinySession}
4 \alias{MockShinySession}
5 \title{Mock Shiny Session}
6 \description{
7 An R6 class suitable for testing purposes. Simulates, to the
8 extent possible, the behavior of the \code{ShinySession} class. The \code{session}
9 parameter provided to Shiny server functions and modules is an instance of
10 a \code{ShinySession} in normal operation.
11
12 Most kinds of module and server testing do not require this class be
13 instantiated manually. See instead \code{\link[=testServer]{testServer()}}.
14
15 In order to support advanced usage, instances of \code{MockShinySession} are
16 \strong{unlocked} so that public methods and fields of instances may be
17 modified. For example, in order to test authentication workflows, the
18 \code{user} or \code{groups} fields may be overridden. Modified instances of
19 \code{MockShinySession} may then be passed explicitly as the \code{session} argument
20 of \code{\link[=testServer]{testServer()}}.
21 }
22 \examples{
23
24 ## ------------------------------------------------
25 ## Method `MockShinySession$setInputs`
26 ## ------------------------------------------------
27
28 \dontrun{
29 session$setInputs(x=1, y=2)
30 }
31 }
32 \section{Public fields}{
33 \if{html}{\out{<div class="r6-fields">}}
34 \describe{
35 \item{\code{env}}{The environment associated with the session.}
36
37 \item{\code{returned}}{The value returned by the module under test.}
38
39 \item{\code{singletons}}{Hardcoded as empty. Needed for rendering HTML (i.e. renderUI).}
40
41 \item{\code{clientData}}{Mock client data that always returns a size for plots.}
42
43 \item{\code{output}}{The shinyoutputs associated with the session.}
44
45 \item{\code{input}}{The reactive inputs associated with the session.}
46
47 \item{\code{userData}}{An environment initialized as empty.}
48
49 \item{\code{progressStack}}{A stack of progress objects.}
50
51 \item{\code{token}}{On a real \code{ShinySession}, used to identify this instance in URLs.}
52
53 \item{\code{cache}}{The session cache object.}
54
55 \item{\code{appcache}}{The app cache object.}
56
57 \item{\code{restoreContext}}{Part of bookmarking support in a real
58 \code{ShinySession} but always \code{NULL} for a \code{MockShinySession}.}
59
60 \item{\code{groups}}{Character vector of groups associated with an authenticated
61 user. Always \code{NULL} for a \code{MockShinySesion}.}
62
63 \item{\code{user}}{The username of an authenticated user. Always \code{NULL} for a
64 \code{MockShinySession}.}
65
66 \item{\code{options}}{A list containing session-level shinyOptions.}
67 }
68 \if{html}{\out{</div>}}
69 }
70 \section{Active bindings}{
71 \if{html}{\out{<div class="r6-active-bindings">}}
72 \describe{
73 \item{\code{files}}{For internal use only.}
74
75 \item{\code{downloads}}{For internal use only.}
76
77 \item{\code{closed}}{Deprecated in \code{ShinySession} and signals an error.}
78
79 \item{\code{session}}{Deprecated in ShinySession and signals an error.}
80
81 \item{\code{request}}{An empty environment where the request should be. The request isn't meaningfully mocked currently.}
82 }
83 \if{html}{\out{</div>}}
84 }
85 \section{Methods}{
86 \subsection{Public methods}{
87 \itemize{
88 \item \href{#method-MockShinySession-new}{\code{MockShinySession$new()}}
89 \item \href{#method-MockShinySession-onFlush}{\code{MockShinySession$onFlush()}}
90 \item \href{#method-MockShinySession-onFlushed}{\code{MockShinySession$onFlushed()}}
91 \item \href{#method-MockShinySession-onEnded}{\code{MockShinySession$onEnded()}}
92 \item \href{#method-MockShinySession-isEnded}{\code{MockShinySession$isEnded()}}
93 \item \href{#method-MockShinySession-isClosed}{\code{MockShinySession$isClosed()}}
94 \item \href{#method-MockShinySession-close}{\code{MockShinySession$close()}}
95 \item \href{#method-MockShinySession-cycleStartAction}{\code{MockShinySession$cycleStartAction()}}
96 \item \href{#method-MockShinySession-fileUrl}{\code{MockShinySession$fileUrl()}}
97 \item \href{#method-MockShinySession-setInputs}{\code{MockShinySession$setInputs()}}
98 \item \href{#method-MockShinySession-.scheduleTask}{\code{MockShinySession$.scheduleTask()}}
99 \item \href{#method-MockShinySession-elapse}{\code{MockShinySession$elapse()}}
100 \item \href{#method-MockShinySession-.now}{\code{MockShinySession$.now()}}
101 \item \href{#method-MockShinySession-defineOutput}{\code{MockShinySession$defineOutput()}}
102 \item \href{#method-MockShinySession-getOutput}{\code{MockShinySession$getOutput()}}
103 \item \href{#method-MockShinySession-ns}{\code{MockShinySession$ns()}}
104 \item \href{#method-MockShinySession-flushReact}{\code{MockShinySession$flushReact()}}
105 \item \href{#method-MockShinySession-makeScope}{\code{MockShinySession$makeScope()}}
106 \item \href{#method-MockShinySession-setEnv}{\code{MockShinySession$setEnv()}}
107 \item \href{#method-MockShinySession-setReturned}{\code{MockShinySession$setReturned()}}
108 \item \href{#method-MockShinySession-getReturned}{\code{MockShinySession$getReturned()}}
109 \item \href{#method-MockShinySession-genId}{\code{MockShinySession$genId()}}
110 \item \href{#method-MockShinySession-rootScope}{\code{MockShinySession$rootScope()}}
111 \item \href{#method-MockShinySession-onUnhandledError}{\code{MockShinySession$onUnhandledError()}}
112 \item \href{#method-MockShinySession-unhandledError}{\code{MockShinySession$unhandledError()}}
113 \item \href{#method-MockShinySession-freezeValue}{\code{MockShinySession$freezeValue()}}
114 \item \href{#method-MockShinySession-onSessionEnded}{\code{MockShinySession$onSessionEnded()}}
115 \item \href{#method-MockShinySession-registerDownload}{\code{MockShinySession$registerDownload()}}
116 \item \href{#method-MockShinySession-getCurrentOutputInfo}{\code{MockShinySession$getCurrentOutputInfo()}}
117 \item \href{#method-MockShinySession-clone}{\code{MockShinySession$clone()}}
118 }
119 }
120 \if{html}{\out{<hr>}}
121 \if{html}{\out{<a id="method-MockShinySession-new"></a>}}
122 \if{latex}{\out{\hypertarget{method-MockShinySession-new}{}}}
123 \subsection{Method \code{new()}}{
124 Create a new MockShinySession.
125 \subsection{Usage}{
126 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$new()}\if{html}{\out{</div>}}
127 }
128
129 }
130 \if{html}{\out{<hr>}}
131 \if{html}{\out{<a id="method-MockShinySession-onFlush"></a>}}
132 \if{latex}{\out{\hypertarget{method-MockShinySession-onFlush}{}}}
133 \subsection{Method \code{onFlush()}}{
134 Define a callback to be invoked before a reactive flush
135 \subsection{Usage}{
136 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$onFlush(fun, once = TRUE)}\if{html}{\out{</div>}}
137 }
138
139 \subsection{Arguments}{
140 \if{html}{\out{<div class="arguments">}}
141 \describe{
142 \item{\code{fun}}{The function to invoke}
143
144 \item{\code{once}}{If \code{TRUE}, will only run once. Otherwise, will run every time reactives are flushed.}
145 }
146 \if{html}{\out{</div>}}
147 }
148 }
149 \if{html}{\out{<hr>}}
150 \if{html}{\out{<a id="method-MockShinySession-onFlushed"></a>}}
151 \if{latex}{\out{\hypertarget{method-MockShinySession-onFlushed}{}}}
152 \subsection{Method \code{onFlushed()}}{
153 Define a callback to be invoked after a reactive flush
154 \subsection{Usage}{
155 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$onFlushed(fun, once = TRUE)}\if{html}{\out{</div>}}
156 }
157
158 \subsection{Arguments}{
159 \if{html}{\out{<div class="arguments">}}
160 \describe{
161 \item{\code{fun}}{The function to invoke}
162
163 \item{\code{once}}{If \code{TRUE}, will only run once. Otherwise, will run every time reactives are flushed.}
164 }
165 \if{html}{\out{</div>}}
166 }
167 }
168 \if{html}{\out{<hr>}}
169 \if{html}{\out{<a id="method-MockShinySession-onEnded"></a>}}
170 \if{latex}{\out{\hypertarget{method-MockShinySession-onEnded}{}}}
171 \subsection{Method \code{onEnded()}}{
172 Define a callback to be invoked when the session ends
173 \subsection{Usage}{
174 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$onEnded(sessionEndedCallback)}\if{html}{\out{</div>}}
175 }
176
177 \subsection{Arguments}{
178 \if{html}{\out{<div class="arguments">}}
179 \describe{
180 \item{\code{sessionEndedCallback}}{The callback to invoke when the session has ended.}
181 }
182 \if{html}{\out{</div>}}
183 }
184 }
185 \if{html}{\out{<hr>}}
186 \if{html}{\out{<a id="method-MockShinySession-isEnded"></a>}}
187 \if{latex}{\out{\hypertarget{method-MockShinySession-isEnded}{}}}
188 \subsection{Method \code{isEnded()}}{
189 Returns \code{FALSE} if the session has not yet been closed
190 \subsection{Usage}{
191 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$isEnded()}\if{html}{\out{</div>}}
192 }
193
194 }
195 \if{html}{\out{<hr>}}
196 \if{html}{\out{<a id="method-MockShinySession-isClosed"></a>}}
197 \if{latex}{\out{\hypertarget{method-MockShinySession-isClosed}{}}}
198 \subsection{Method \code{isClosed()}}{
199 Returns \code{FALSE} if the session has not yet been closed
200 \subsection{Usage}{
201 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$isClosed()}\if{html}{\out{</div>}}
202 }
203
204 }
205 \if{html}{\out{<hr>}}
206 \if{html}{\out{<a id="method-MockShinySession-close"></a>}}
207 \if{latex}{\out{\hypertarget{method-MockShinySession-close}{}}}
208 \subsection{Method \code{close()}}{
209 Closes the session
210 \subsection{Usage}{
211 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$close()}\if{html}{\out{</div>}}
212 }
213
214 }
215 \if{html}{\out{<hr>}}
216 \if{html}{\out{<a id="method-MockShinySession-cycleStartAction"></a>}}
217 \if{latex}{\out{\hypertarget{method-MockShinySession-cycleStartAction}{}}}
218 \subsection{Method \code{cycleStartAction()}}{
219 Unsophisticated mock implementation that merely invokes
220 \subsection{Usage}{
221 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$cycleStartAction(callback)}\if{html}{\out{</div>}}
222 }
223
224 \subsection{Arguments}{
225 \if{html}{\out{<div class="arguments">}}
226 \describe{
227 \item{\code{callback}}{The callback to be invoked.}
228 }
229 \if{html}{\out{</div>}}
230 }
231 }
232 \if{html}{\out{<hr>}}
233 \if{html}{\out{<a id="method-MockShinySession-fileUrl"></a>}}
234 \if{latex}{\out{\hypertarget{method-MockShinySession-fileUrl}{}}}
235 \subsection{Method \code{fileUrl()}}{
236 Base64-encode the given file. Needed for image rendering.
237 \subsection{Usage}{
238 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$fileUrl(name, file, contentType = "application/octet-stream")}\if{html}{\out{</div>}}
239 }
240
241 \subsection{Arguments}{
242 \if{html}{\out{<div class="arguments">}}
243 \describe{
244 \item{\code{name}}{Not used}
245
246 \item{\code{file}}{The file to be encoded}
247
248 \item{\code{contentType}}{The content type of the base64-encoded string}
249 }
250 \if{html}{\out{</div>}}
251 }
252 }
253 \if{html}{\out{<hr>}}
254 \if{html}{\out{<a id="method-MockShinySession-setInputs"></a>}}
255 \if{latex}{\out{\hypertarget{method-MockShinySession-setInputs}{}}}
256 \subsection{Method \code{setInputs()}}{
257 Sets reactive values associated with the \code{session$inputs}
258 object and flushes the reactives.
259 \subsection{Usage}{
260 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$setInputs(...)}\if{html}{\out{</div>}}
261 }
262
263 \subsection{Arguments}{
264 \if{html}{\out{<div class="arguments">}}
265 \describe{
266 \item{\code{...}}{The inputs to set. These arguments are processed with
267 \code{\link[rlang:list2]{rlang::list2()}} and so are \emph{\link[rlang:dyn-dots]{dynamic}}. Input names
268 may not be duplicated.}
269 }
270 \if{html}{\out{</div>}}
271 }
272 \subsection{Examples}{
273 \if{html}{\out{<div class="r example copy">}}
274 \preformatted{\dontrun{
275 session$setInputs(x=1, y=2)
276 }
277 }
278 \if{html}{\out{</div>}}
279
280 }
281
282 }
283 \if{html}{\out{<hr>}}
284 \if{html}{\out{<a id="method-MockShinySession-.scheduleTask"></a>}}
285 \if{latex}{\out{\hypertarget{method-MockShinySession-.scheduleTask}{}}}
286 \subsection{Method \code{.scheduleTask()}}{
287 An internal method which shouldn't be used by others.
288 Schedules \code{callback} for execution after some number of \code{millis}
289 milliseconds.
290 \subsection{Usage}{
291 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$.scheduleTask(millis, callback)}\if{html}{\out{</div>}}
292 }
293
294 \subsection{Arguments}{
295 \if{html}{\out{<div class="arguments">}}
296 \describe{
297 \item{\code{millis}}{The number of milliseconds on which to schedule a callback}
298
299 \item{\code{callback}}{The function to schedule.}
300 }
301 \if{html}{\out{</div>}}
302 }
303 }
304 \if{html}{\out{<hr>}}
305 \if{html}{\out{<a id="method-MockShinySession-elapse"></a>}}
306 \if{latex}{\out{\hypertarget{method-MockShinySession-elapse}{}}}
307 \subsection{Method \code{elapse()}}{
308 Simulate the passing of time by the given number of milliseconds.
309 \subsection{Usage}{
310 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$elapse(millis)}\if{html}{\out{</div>}}
311 }
312
313 \subsection{Arguments}{
314 \if{html}{\out{<div class="arguments">}}
315 \describe{
316 \item{\code{millis}}{The number of milliseconds to advance time.}
317 }
318 \if{html}{\out{</div>}}
319 }
320 }
321 \if{html}{\out{<hr>}}
322 \if{html}{\out{<a id="method-MockShinySession-.now"></a>}}
323 \if{latex}{\out{\hypertarget{method-MockShinySession-.now}{}}}
324 \subsection{Method \code{.now()}}{
325 An internal method which shouldn't be used by others.
326 \subsection{Usage}{
327 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$.now()}\if{html}{\out{</div>}}
328 }
329
330 \subsection{Returns}{
331 Elapsed time in milliseconds.
332 }
333 }
334 \if{html}{\out{<hr>}}
335 \if{html}{\out{<a id="method-MockShinySession-defineOutput"></a>}}
336 \if{latex}{\out{\hypertarget{method-MockShinySession-defineOutput}{}}}
337 \subsection{Method \code{defineOutput()}}{
338 An internal method which shouldn't be used by others.
339 Defines an output in a way that sets private$currentOutputName
340 appropriately.
341 \subsection{Usage}{
342 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$defineOutput(name, func, label)}\if{html}{\out{</div>}}
343 }
344
345 \subsection{Arguments}{
346 \if{html}{\out{<div class="arguments">}}
347 \describe{
348 \item{\code{name}}{The name of the output.}
349
350 \item{\code{func}}{The render definition.}
351
352 \item{\code{label}}{Not used.}
353 }
354 \if{html}{\out{</div>}}
355 }
356 }
357 \if{html}{\out{<hr>}}
358 \if{html}{\out{<a id="method-MockShinySession-getOutput"></a>}}
359 \if{latex}{\out{\hypertarget{method-MockShinySession-getOutput}{}}}
360 \subsection{Method \code{getOutput()}}{
361 An internal method which shouldn't be used by others. Forces
362 evaluation of any reactive dependencies of the output function.
363 \subsection{Usage}{
364 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$getOutput(name)}\if{html}{\out{</div>}}
365 }
366
367 \subsection{Arguments}{
368 \if{html}{\out{<div class="arguments">}}
369 \describe{
370 \item{\code{name}}{The name of the output.}
371 }
372 \if{html}{\out{</div>}}
373 }
374 \subsection{Returns}{
375 The return value of the function responsible for rendering the
376 output.
377 }
378 }
379 \if{html}{\out{<hr>}}
380 \if{html}{\out{<a id="method-MockShinySession-ns"></a>}}
381 \if{latex}{\out{\hypertarget{method-MockShinySession-ns}{}}}
382 \subsection{Method \code{ns()}}{
383 Returns the given id prefixed by this namespace's id.
384 \subsection{Usage}{
385 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$ns(id)}\if{html}{\out{</div>}}
386 }
387
388 \subsection{Arguments}{
389 \if{html}{\out{<div class="arguments">}}
390 \describe{
391 \item{\code{id}}{The id to prefix with a namespace id.}
392 }
393 \if{html}{\out{</div>}}
394 }
395 \subsection{Returns}{
396 The id with a namespace prefix.
397 }
398 }
399 \if{html}{\out{<hr>}}
400 \if{html}{\out{<a id="method-MockShinySession-flushReact"></a>}}
401 \if{latex}{\out{\hypertarget{method-MockShinySession-flushReact}{}}}
402 \subsection{Method \code{flushReact()}}{
403 Trigger a reactive flush right now.
404 \subsection{Usage}{
405 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$flushReact()}\if{html}{\out{</div>}}
406 }
407
408 }
409 \if{html}{\out{<hr>}}
410 \if{html}{\out{<a id="method-MockShinySession-makeScope"></a>}}
411 \if{latex}{\out{\hypertarget{method-MockShinySession-makeScope}{}}}
412 \subsection{Method \code{makeScope()}}{
413 Create and return a namespace-specific session proxy.
414 \subsection{Usage}{
415 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$makeScope(namespace)}\if{html}{\out{</div>}}
416 }
417
418 \subsection{Arguments}{
419 \if{html}{\out{<div class="arguments">}}
420 \describe{
421 \item{\code{namespace}}{Character vector indicating a namespace.}
422 }
423 \if{html}{\out{</div>}}
424 }
425 \subsection{Returns}{
426 A new session proxy.
427 }
428 }
429 \if{html}{\out{<hr>}}
430 \if{html}{\out{<a id="method-MockShinySession-setEnv"></a>}}
431 \if{latex}{\out{\hypertarget{method-MockShinySession-setEnv}{}}}
432 \subsection{Method \code{setEnv()}}{
433 Set the environment associated with a testServer() call, but
434 only if it has not previously been set. This ensures that only the
435 environment of the outermost module under test is the one retained. In
436 other words, the first assignment wins.
437 \subsection{Usage}{
438 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$setEnv(env)}\if{html}{\out{</div>}}
439 }
440
441 \subsection{Arguments}{
442 \if{html}{\out{<div class="arguments">}}
443 \describe{
444 \item{\code{env}}{The environment to retain.}
445 }
446 \if{html}{\out{</div>}}
447 }
448 \subsection{Returns}{
449 The provided \code{env}.
450 }
451 }
452 \if{html}{\out{<hr>}}
453 \if{html}{\out{<a id="method-MockShinySession-setReturned"></a>}}
454 \if{latex}{\out{\hypertarget{method-MockShinySession-setReturned}{}}}
455 \subsection{Method \code{setReturned()}}{
456 Set the value returned by the module call and proactively
457 flush. Note that this method may be called multiple times if modules
458 are nested. The last assignment, corresponding to an invocation of
459 setReturned() in the outermost module, wins.
460 \subsection{Usage}{
461 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$setReturned(value)}\if{html}{\out{</div>}}
462 }
463
464 \subsection{Arguments}{
465 \if{html}{\out{<div class="arguments">}}
466 \describe{
467 \item{\code{value}}{The value returned from the module}
468 }
469 \if{html}{\out{</div>}}
470 }
471 \subsection{Returns}{
472 The provided \code{value}.
473 }
474 }
475 \if{html}{\out{<hr>}}
476 \if{html}{\out{<a id="method-MockShinySession-getReturned"></a>}}
477 \if{latex}{\out{\hypertarget{method-MockShinySession-getReturned}{}}}
478 \subsection{Method \code{getReturned()}}{
479 Get the value returned by the module call.
480 \subsection{Usage}{
481 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$getReturned()}\if{html}{\out{</div>}}
482 }
483
484 \subsection{Returns}{
485 The value returned by the module call
486 }
487 }
488 \if{html}{\out{<hr>}}
489 \if{html}{\out{<a id="method-MockShinySession-genId"></a>}}
490 \if{latex}{\out{\hypertarget{method-MockShinySession-genId}{}}}
491 \subsection{Method \code{genId()}}{
492 Generate a distinct character identifier for use as a proxy
493 namespace.
494 \subsection{Usage}{
495 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$genId()}\if{html}{\out{</div>}}
496 }
497
498 \subsection{Returns}{
499 A character identifier unique to the current session.
500 }
501 }
502 \if{html}{\out{<hr>}}
503 \if{html}{\out{<a id="method-MockShinySession-rootScope"></a>}}
504 \if{latex}{\out{\hypertarget{method-MockShinySession-rootScope}{}}}
505 \subsection{Method \code{rootScope()}}{
506 Provides a way to access the root \code{MockShinySession} from
507 any descendant proxy.
508 \subsection{Usage}{
509 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$rootScope()}\if{html}{\out{</div>}}
510 }
511
512 \subsection{Returns}{
513 The root \code{MockShinySession}.
514 }
515 }
516 \if{html}{\out{<hr>}}
517 \if{html}{\out{<a id="method-MockShinySession-onUnhandledError"></a>}}
518 \if{latex}{\out{\hypertarget{method-MockShinySession-onUnhandledError}{}}}
519 \subsection{Method \code{onUnhandledError()}}{
520 Add an unhandled error callback.
521 \subsection{Usage}{
522 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$onUnhandledError(callback)}\if{html}{\out{</div>}}
523 }
524
525 \subsection{Arguments}{
526 \if{html}{\out{<div class="arguments">}}
527 \describe{
528 \item{\code{callback}}{The callback to add, which should accept an error object
529 as its first argument.}
530 }
531 \if{html}{\out{</div>}}
532 }
533 \subsection{Returns}{
534 A deregistration function.
535 }
536 }
537 \if{html}{\out{<hr>}}
538 \if{html}{\out{<a id="method-MockShinySession-unhandledError"></a>}}
539 \if{latex}{\out{\hypertarget{method-MockShinySession-unhandledError}{}}}
540 \subsection{Method \code{unhandledError()}}{
541 Called by observers when a reactive expression errors.
542 \subsection{Usage}{
543 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$unhandledError(e, close = TRUE)}\if{html}{\out{</div>}}
544 }
545
546 \subsection{Arguments}{
547 \if{html}{\out{<div class="arguments">}}
548 \describe{
549 \item{\code{e}}{An error object.}
550
551 \item{\code{close}}{If \code{TRUE}, the session will be closed after the error is
552 handled, defaults to \code{FALSE}.}
553 }
554 \if{html}{\out{</div>}}
555 }
556 }
557 \if{html}{\out{<hr>}}
558 \if{html}{\out{<a id="method-MockShinySession-freezeValue"></a>}}
559 \if{latex}{\out{\hypertarget{method-MockShinySession-freezeValue}{}}}
560 \subsection{Method \code{freezeValue()}}{
561 Freeze a value until the flush cycle completes.
562 \subsection{Usage}{
563 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$freezeValue(x, name)}\if{html}{\out{</div>}}
564 }
565
566 \subsection{Arguments}{
567 \if{html}{\out{<div class="arguments">}}
568 \describe{
569 \item{\code{x}}{A \code{ReactiveValues} object.}
570
571 \item{\code{name}}{The name of a reactive value within \code{x}.}
572 }
573 \if{html}{\out{</div>}}
574 }
575 }
576 \if{html}{\out{<hr>}}
577 \if{html}{\out{<a id="method-MockShinySession-onSessionEnded"></a>}}
578 \if{latex}{\out{\hypertarget{method-MockShinySession-onSessionEnded}{}}}
579 \subsection{Method \code{onSessionEnded()}}{
580 Registers the given callback to be invoked when the session
581 is closed (i.e. the connection to the client has been severed). The
582 return value is a function which unregisters the callback. If multiple
583 callbacks are registered, the order in which they are invoked is not
584 guaranteed.
585 \subsection{Usage}{
586 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$onSessionEnded(sessionEndedCallback)}\if{html}{\out{</div>}}
587 }
588
589 \subsection{Arguments}{
590 \if{html}{\out{<div class="arguments">}}
591 \describe{
592 \item{\code{sessionEndedCallback}}{Function to call when the session ends.}
593 }
594 \if{html}{\out{</div>}}
595 }
596 }
597 \if{html}{\out{<hr>}}
598 \if{html}{\out{<a id="method-MockShinySession-registerDownload"></a>}}
599 \if{latex}{\out{\hypertarget{method-MockShinySession-registerDownload}{}}}
600 \subsection{Method \code{registerDownload()}}{
601 Associated a downloadable file with the session.
602 \subsection{Usage}{
603 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$registerDownload(name, filename, contentType, content)}\if{html}{\out{</div>}}
604 }
605
606 \subsection{Arguments}{
607 \if{html}{\out{<div class="arguments">}}
608 \describe{
609 \item{\code{name}}{The un-namespaced output name to associate with the
610 downloadable file.}
611
612 \item{\code{filename}}{A string or function designating the name of the file.}
613
614 \item{\code{contentType}}{A string of the content type of the file. Not used by
615 \code{MockShinySession}.}
616
617 \item{\code{content}}{A function that takes a single argument file that is a
618 file path (string) of a nonexistent temp file, and writes the content
619 to that file path. (Reactive values and functions may be used from this
620 function.)}
621 }
622 \if{html}{\out{</div>}}
623 }
624 }
625 \if{html}{\out{<hr>}}
626 \if{html}{\out{<a id="method-MockShinySession-getCurrentOutputInfo"></a>}}
627 \if{latex}{\out{\hypertarget{method-MockShinySession-getCurrentOutputInfo}{}}}
628 \subsection{Method \code{getCurrentOutputInfo()}}{
629 Get information about the output that is currently being
630 executed.
631 \subsection{Usage}{
632 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$getCurrentOutputInfo()}\if{html}{\out{</div>}}
633 }
634
635 \subsection{Returns}{
636 A list with with the \code{name} of the output. If no output is
637 currently being executed, this will return \code{NULL}.
638 output, or \code{NULL} if no output is currently executing.
639 }
640 }
641 \if{html}{\out{<hr>}}
642 \if{html}{\out{<a id="method-MockShinySession-clone"></a>}}
643 \if{latex}{\out{\hypertarget{method-MockShinySession-clone}{}}}
644 \subsection{Method \code{clone()}}{
645 The objects of this class are cloneable with this method.
646 \subsection{Usage}{
647 \if{html}{\out{<div class="r">}}\preformatted{MockShinySession$clone(deep = FALSE)}\if{html}{\out{</div>}}
648 }
649
650 \subsection{Arguments}{
651 \if{html}{\out{<div class="arguments">}}
652 \describe{
653 \item{\code{deep}}{Whether to make a deep clone.}
654 }
655 \if{html}{\out{</div>}}
656 }
657 }
658 }