Debian Codegraph @

man/runGadget.Rd

raw
1 % Generated by roxygen2: do not edit by hand
2 % Please edit documentation in R/runapp.R
3 \name{runGadget}
4 \alias{runGadget}
5 \title{Run a gadget}
6 \usage{
7 runGadget(
8 app,
9 server = NULL,
10 port = getOption("shiny.port"),
11 viewer = paneViewer(),
12 stopOnCancel = TRUE
13 )
14 }
15 \arguments{
16 \item{app}{Either a Shiny app object as created by
17 \code{\link[=shiny]{shinyApp()}} et al, or, a UI object.}
18
19 \item{server}{Ignored if \code{app} is a Shiny app object; otherwise, passed
20 along to \code{shinyApp} (i.e. \code{shinyApp(ui = app, server = server)}).}
21
22 \item{port}{See \code{\link[=shiny]{runApp()}}.}
23
24 \item{viewer}{Specify where the gadget should be displayed--viewer pane,
25 dialog window, or external browser--by passing in a call to one of the
26 \code{\link[=viewer]{viewer()}} functions.}
27
28 \item{stopOnCancel}{If \code{TRUE} (the default), then an \code{observeEvent}
29 is automatically created that handles \code{input$cancel} by calling
30 \code{stopApp()} with an error. Pass \code{FALSE} if you want to handle
31 \code{input$cancel} yourself.}
32 }
33 \value{
34 The value returned by the gadget.
35 }
36 \description{
37 Similar to \code{runApp}, but handles \code{input$cancel} automatically, and
38 if running in RStudio, defaults to viewing the app in the Viewer pane.
39 }
40 \examples{
41 \dontrun{
42 library(shiny)
43
44 ui <- fillPage(...)
45
46 server <- function(input, output, session) {
47 ...
48 }
49
50 # Either pass ui/server as separate arguments...
51 runGadget(ui, server)
52
53 # ...or as a single app object
54 runGadget(shinyApp(ui, server))
55 }
56 }