Files
shiny/man/onFlush.Rd
Barbara Borges Ribeiro aff3ac0bb3 Add onStop function (#1770)
* NEWS item

* added `onStop` arg to `shinyApp()` (and renamed our internal `onEnd` - which is what was calling `on.exit()` already - to `onStop` as well)

* added onStop() function

* add entry for documentation

* make it work for all possible app structures (interactive, saved as app.R, saved as ui.R and server.R)

* fix #1772: make sure `onStart` works in all scenarios

* update NEWS

* improved wording

* more wording

* and more wording

* don't stop execution if a `onStop` callback function results in an error

* remove "(all sessions have been disconnected)" because it's misleading

* add @seealso documentation

* shamefully forgot to Cmd Shift D

* change code place

* Code review feedback

* onStop: use session argument instead of scope
2017-07-27 14:54:55 -05:00

41 lines
1.3 KiB
R

% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/shiny.R
\name{onFlush}
\alias{onFlush}
\alias{onFlushed}
\alias{onSessionEnded}
\title{Add callbacks for Shiny session events}
\usage{
onFlush(fun, once = TRUE, session = getDefaultReactiveDomain())
onFlushed(fun, once = TRUE, session = getDefaultReactiveDomain())
onSessionEnded(fun, session = getDefaultReactiveDomain())
}
\arguments{
\item{fun}{A callback function.}
\item{once}{Should the function be run once, and then cleared, or should it
re-run each time the event occurs. (Only for \code{onFlush} and
\code{onFlushed}.)}
\item{session}{A shiny session object.}
}
\description{
These functions are for registering callbacks on Shiny session events.
\code{onFlush} registers a function that will be called before Shiny flushes
the reactive system. \code{onFlushed} registers a function that will be
called after Shiny flushes the reactive system. \code{onSessionEnded}
registers a function to be called after the client has disconnected.
}
\details{
These functions should be called within the application's server function.
All of these functions return a function which can be called with no
arguments to cancel the registration.
}
\seealso{
\code{\link{onStop}()} for registering callbacks that will be
invoked when the application exits, or when a session ends.
}