Skip to content

Commit 79a4996

Browse files
author
Ryan Patrick Kyle
committed
📚 document features inside package
1 parent 1461ee7 commit 79a4996

File tree

2 files changed

+38
-13
lines changed

2 files changed

+38
-13
lines changed

R/dash.R

+37-13
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,10 @@
1212
#' assets_ignore = '',
1313
#' serve_locally = TRUE,
1414
#' routes_pathname_prefix = '/',
15-
#' requests_pathname_prefix = '/'
15+
#' requests_pathname_prefix = '/',
16+
#' external_scripts = NULL,
17+
#' external_stylesheets = NULL,
18+
#' suppress_callback_exceptions = FALSE
1619
#' )
1720
#'
1821
#' @section Arguments:
@@ -88,11 +91,32 @@
8891
#' The latter may offer improved performance relative to callbacks written
8992
#' in R.
9093
#' }
94+
#' \item{`callback_context()`}{
95+
#' The `callback_context` method permits retrieving the inputs which triggered
96+
#' the firing of a given callback, and allows introspection of the input/state
97+
#' values given their names. It is only available from within a callback;
98+
#' attempting to use this method outside of a callback will result in a warning.
99+
#' }
91100
#' \item{`run_server(host = Sys.getenv('DASH_HOST', "127.0.0.1"),
92101
#' port = Sys.getenv('DASH_PORT', 8050), block = TRUE, showcase = FALSE, ...)`}{
93-
#' Launch the application. If provided, `host`/`port` set
94-
#' the `host`/`port` fields of the underlying [fiery::Fire] web
95-
#' server. The `block`/`showcase`/`...` arguments are passed along
102+
#' The `run_server` method has 13 formal arguments, several of which are optional:
103+
#' \describe{
104+
#' \item{host}{Character. A string specifying a valid IPv4 address for the Fiery server, or `0.0.0.0` to listen on all addresses. Default is `127.0.0.1` Environment variable: `DASH_HOST`.}
105+
#' \item{port}{Integer. Specifies the port number on which the server should listen (default is `8050`). Environment variable: `DASH_PORT`.}
106+
#' \item{block}{Logical. Start the server while blocking console input? Default is `TRUE`.}
107+
#' \item{showcase}{Logical. Load the Dash application into the default web browser when server starts? Default is `FALSE`.}
108+
#' \item{use_viewer}{Logical. Load the Dash application into RStudio's viewer pane? Requires that `host` is either `127.0.0.1` or `localhost`, and that Dash application is started within RStudio; if `use_viewer = TRUE` and these conditions are not satsified, the user is warned and the app opens in the default browser instead. Default is `FALSE`.}
109+
#' \item{debug}{Logical. Enable/disable all the dev tools unless overridden by the arguments or environment variables. Default is `FALSE` when called via `run_server`. Environment variable: `DASH_DEBUG`.}
110+
#' \item{dev_tools_ui}{Logical. Show Dash's dev tools UI? Default is `TRUE` if `debug == TRUE`, `FALSE` otherwise. Environment variable: `DASH_UI`.}
111+
#' \item{dev_tools_hot_reload}{Logical. Activate hot reloading when app, assets, and component files change? Default is `TRUE` if `debug == TRUE`, `FALSE` otherwise. Requires that the Dash application is loaded using `source()`, so that `srcref` attributes are available for executed code. Environment variable: `DASH_HOT_RELOAD`.}
112+
#' \item{dev_tools_hot_reload_interval}{Numeric. Interval in seconds for the client to request the reload hash. Default is `3`. Environment variable: `DASH_HOT_RELOAD_INTERVAL`.}
113+
#' \item{dev_tools_hot_reload_watch_interval}{Numeric. Interval in seconds for the server to check asset and component folders for changes. Default `0.5`. Environment variable: `DASH_HOT_RELOAD_WATCH_INTERVAL`.}
114+
#' \item{dev_tools_props_check}{Logical. Validate the types and values of Dash component properties? Default is `TRUE` if `debug == TRUE`, `FALSE` otherwise. Environment variable: `DASH_PROPS_CHECK`.}
115+
#' \item{dev_tools_prune_errors}{Logical. Reduce tracebacks to just user code, stripping out Fiery and Dash pieces? Only available with debugging. `TRUE` by default, set to `FALSE` to see the complete traceback. Environment variable: `DASH_PRUNE_ERRORS`.}
116+
#' \item{dev_tools_silence_routes_logging}{Logical. Replace Fiery's default logger with `dashLogger` instead (will remove all routes logging)? Enabled with debugging by default because hot reload hash checks generate a lot of requests.}
117+
#' }
118+
#' Starts the Fiery server in local mode. If a parameter can be set by an environment variable, that is listed too. Values provided here take precedence over environment variables.
119+
#' Launch the application. If provided, `host`/`port` set the `host`/`port` fields of the underlying [fiery::Fire] web server. The `block`/`showcase`/`...` arguments are passed along
96120
#' to the `ignite()` method of the [fiery::Fire] server.
97121
#' }
98122
#' }
@@ -609,14 +633,14 @@ Dash <- R6::R6Class(
609633
block = TRUE,
610634
showcase = FALSE,
611635
use_viewer = FALSE,
612-
dev_tools_prune_errors = TRUE,
613-
debug = FALSE,
614-
dev_tools_ui = NULL,
615-
dev_tools_props_check = NULL,
616-
dev_tools_hot_reload = NULL,
617-
dev_tools_hot_reload_interval = 3,
618-
dev_tools_hot_reload_watch_interval = 0.5,
619-
dev_tools_silence_routes_logging = NULL,
636+
dev_tools_prune_errors = Sys.getenv('DASH_PRUNE_ERRORS', TRUE),
637+
debug = Sys.getenv('DASH_DEBUG', FALSE),
638+
dev_tools_ui = Sys.getenv('DASH_UI', NULL),
639+
dev_tools_props_check = Sys.getenv('DASH_PROPS_CHECK', NULL),
640+
dev_tools_hot_reload = Sys.getenv('DASH_HOT_RELOAD', NULL),
641+
dev_tools_hot_reload_interval = Sys.getenv('DASH_HOT_RELOAD_INTERVAL', 3),
642+
dev_tools_hot_reload_watch_interval = Sys.getenv('DASH_HOT_RELOAD_WATCH_INTERVAL', 0.5),
643+
dev_tools_silence_routes_logging = Sys.getenv('DASH_SILENCE_ROUTES_LOGGING', NULL),
620644
...) {
621645
if (exists("dash_nested_fiery_server", env=parent.frame(1))) {
622646
# fiery is attempting to launch a server within a server, abort gracefully
@@ -639,7 +663,7 @@ Dash <- R6::R6Class(
639663
# set the modtime to track state of the Dash app directory
640664
# this calls getAppPath, which will try three approaches to
641665
# identifying the local app path (depending on whether the app
642-
# is invoked via script, source(), or executed dire ctly from console)
666+
# is invoked via script, source(), or executed directly from console)
643667
if (is.null(dev_tools_ui) && debug || isTRUE(dev_tools_ui)) {
644668
self$config$ui <- TRUE
645669
} else {

R/utils.R

+1
Original file line numberDiff line numberDiff line change
@@ -1099,6 +1099,7 @@ dashLogger <- function(event = NULL,
10991099
}
11001100
}
11011101

1102+
#' @export
11021103
clientsideFunction <- function(namespace, function_name) {
11031104
return(list(namespace=namespace, function_name=function_name))
11041105
}

0 commit comments

Comments
 (0)