Add methods: reactlog, reactlogShow, and reactlogReset. Depricate showReactLog

Update links to help file to not use `showReactLog`, but `reactlogShow`
Use updated reactlog pkg function api of reactlog_*. This may fail right now, but rerun travis when the reactlog code is merged into master.
This commit is contained in:
Barret Schloerke
2019-01-30 12:20:22 -05:00
parent 8ae31eb998
commit bcac115c3d
8 changed files with 63 additions and 13 deletions

View File

@@ -75,11 +75,11 @@ reactIdStr <- function(num) {
#'
#' 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
#' application--you can run the \code{reactlogShow} 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.
#' call \code{reactlogShow()} explicitly.
#'
#' For security and performance reasons, do not enable
#' \code{shiny.reactlog} in production environments. When the option is
@@ -88,16 +88,41 @@ reactIdStr <- function(num) {
#'
#' @param time A boolean that specifies whether or not to display the
#' time that each reactive.
#' @name reactlog
NULL
#' @describeIn reactlog Return a list of reactive information. Can be used in conjunction with
#' \code{reactlog::\link[reactlog]{reactlog_show}} to later display the reactlog graph.
#' @export
showReactLog <- function(time = TRUE) {
check_reactlog()
reactlog::show_reactlog(rLog$asList(), time = time)
reactlog <- function() {
rLog$asList()
}
#' @describeIn reactlog Display a full reactlog graph for all sessions.
#' @export
reactlogShow <- function(time = TRUE) {
check_reactlog()
reactlog::reactlog_show(reactlog(), time = time)
}
#' @describeIn reactlog This function is deprecated. You should use \code{\link{reactlogShow}}
#' @export
# legacy purposes
showReactLog <- function(...) {
shinyDeprecated(new = "`reactlogShow`", version = "1.2.0")
reactlogShow(...)
}
#' @describeIn reactlog Resets the entire reactlog stack. Useful for debugging and removing all prior reactive history.
#' @export
reactlogReset <- function() {
rLog$reset()
}
# called in "/reactlog" middleware
renderReactlog <- function(sessionToken = NULL, time = TRUE) {
check_reactlog()
reactlog::render_reactlog(
rLog$asList(),
reactlog::reactlog_render(
reactlog(),
session_token = sessionToken,
time = time
)