mirror of
https://github.com/rstudio/shiny.git
synced 2026-02-08 05:35:07 -05:00
After discussing with @trestletech, the semantics are just not right. When using it with a renderXXX function, it doesn't actually stop recomputation, so the only reasonable place to use it is in a reactive expression, but if that's true then this is a terrible looking API. Will replace soon with something better.
30 lines
569 B
R
30 lines
569 B
R
% Generated by roxygen2 (4.0.2): do not edit by hand
|
|
\name{observeEvent}
|
|
\alias{observeEvent}
|
|
\title{Event handler}
|
|
\usage{
|
|
observeEvent(eventExpr, callback, env = parent.frame(), quoted = FALSE)
|
|
}
|
|
\description{
|
|
Event handler
|
|
}
|
|
\examples{
|
|
\dontrun{
|
|
# In ui.R:
|
|
shinyUI(basicPage(
|
|
numericInput("n", "Number of observations", 5),
|
|
actionButton("saveButton", "Save")
|
|
))
|
|
# In server.R:
|
|
shinyServer(function(input, output) {
|
|
observeEvent(input$saveButton, function() {
|
|
write.csv(runif(input$n), file = "data.csv")
|
|
})
|
|
})
|
|
}
|
|
}
|
|
\seealso{
|
|
\code{\link{actionButton}}
|
|
}
|
|
|