Skip to content

Commit

Permalink
Add docs for showReactLog. Un-export writeReactLog.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheng5 committed Aug 23, 2013
1 parent dd1d443 commit 86e291f
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 2 deletions.
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,6 @@ export(validateCssUnit)
export(verbatimTextOutput)
export(wellPanel)
export(withTags)
export(writeReactLog)
import(RJSONIO)
import(caTools)
import(digest)
Expand Down
34 changes: 33 additions & 1 deletion R/graph.R
Original file line number Diff line number Diff line change
@@ -1,8 +1,40 @@
#' @export
writeReactLog <- function(file=stdout()) {
cat(RJSONIO::toJSON(.graphEnv$log, pretty=TRUE), file=file)
}

#' Reactive Log Visualizer
#'
#' Provides an interactive browser-based tool for visualizing reactive
#' dependencies and execution in your application.
#'
#' To use the reactive log visualizer, start with a fresh R session and
#' run the command \code{options(shiny.reactlog=TRUE)}; then launch your
#' application in the usual way (e.g. using \code{\link{runApp}}). At
#' any time you can hit Ctrl+F3 (or for Mac users, Command+F3) in your
#' web browser to launch the reactive log visualization.
#'
#' The reactive log visualization only includes reactive activity up
#' until the time the report was loaded. If you want to see more recent
#' activity, refresh the browser.
#'
#' Note that Shiny does not distinguish between reactive dependencies
#' that "belong" to one Shiny user session versus another, so the
#' visualization will include all reactive activity that has taken place
#' in the process, not just for a particular application or session.
#'
#' As an alternative to pressing Ctrl/Command+F3--for example, if you
#' are using reactives outside of the context of a Shiny
#' application--you can run the \code{showReactLog} function, which will
#' generate the reactive log visualization as a static HTML file and
#' launch it in your default browser. In this case, refreshing your
#' browser will not load new activity into the report; you will need to
#' call \code{showReactLog()} explicitly.
#'
#' For security and performance reasons, do not enable
#' \code{shiny.reactlog} in production environments. When the option is
#' enabled, it's possible for any user of your app to see at least some
#' of the source code of your reactive expressions and observers.
#'
#' @export
showReactLog <- function() {
browseURL(renderReactLog())
Expand Down
47 changes: 47 additions & 0 deletions man/showReactLog.Rd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
\name{showReactLog}
\alias{showReactLog}
\title{Reactive Log Visualizer}
\usage{
showReactLog()
}
\description{
Provides an interactive browser-based tool for
visualizing reactive dependencies and execution in your
application.
}
\details{
To use the reactive log visualizer, start with a fresh R
session and run the command
\code{options(shiny.reactlog=TRUE)}; then launch your
application in the usual way (e.g. using
\code{\link{runApp}}). At any time you can hit Ctrl+F3
(or for Mac users, Command+F3) in your web browser to
launch the reactive log visualization.

The reactive log visualization only includes reactive
activity up until the time the report was loaded. If you
want to see more recent activity, refresh the browser.

Note that Shiny does not distinguish between reactive
dependencies that "belong" to one Shiny user session
versus another, so the visualization will include all
reactive activity that has taken place in the process,
not just for a particular application or session.

As an alternative to pressing Ctrl/Command+F3--for
example, if you are using reactives outside of the
context of a Shiny application--you can run the
\code{showReactLog} function, which will generate the
reactive log visualization as a static HTML file and
launch it in your default browser. In this case,
refreshing your browser will not load new activity into
the report; you will need to call \code{showReactLog()}
explicitly.

For security and performance reasons, do not enable
\code{shiny.reactlog} in production environments. When
the option is enabled, it's possible for any user of your
app to see at least some of the source code of your
reactive expressions and observers.
}

0 comments on commit 86e291f

Please sign in to comment.