Skip to content

Commit face52c

Browse files
author
Ryan Patrick Kyle
committed
🐾 make dependencies_* methods private
1 parent 3ff3c62 commit face52c

1 file changed

Lines changed: 32 additions & 40 deletions

File tree

R/dash.R

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -71,15 +71,6 @@
7171
#' provide [input] (and/or [state]) object(s) (which should reference
7272
#' layout components) as argument value(s) to `func`.
7373
#' }
74-
#' \item{`dependencies_set(dependencies = NULL, add = TRUE)`}{
75-
#' Adds additional HTML dependencies to your dash application (beyond the 'internal' dependencies).
76-
#' The `dependencies` argument accepts [htmltools::htmlDependency] or
77-
#' [htmltools::htmlDependencies]. The `section` argument determines whether
78-
#' your dependencies are placed inside `<head>` or `<footer>`.
79-
#' }
80-
#' \item{`dependencies_get(all = FALSE)`}{
81-
#' Retrieve (just user-defined or all) HTML dependencies.
82-
#' }
8374
#' \item{`run_server(host = NULL, port = NULL, block = TRUE, showcase = FALSE, ...)`}{
8475
#' Launch the application. If provided, `host`/`port` set
8576
#' the `host`/`port` fields of the underlying [fiery::Fire] web
@@ -346,37 +337,6 @@ Dash <- R6::R6Class(
346337
invisible(private$layout_render())
347338
},
348339

349-
# ------------------------------------------------------------------------
350-
# HTML dependency management
351-
# ------------------------------------------------------------------------
352-
dependencies_get = function() {
353-
c(private$dependencies_user, private$dependencies)
354-
},
355-
dependencies_get_internal = function() {
356-
private$dependencies_internal
357-
},
358-
dependencies_set = function(dependencies = list(), add = TRUE) {
359-
360-
if (!length(dependencies)) return()
361-
362-
# do a sensible thing if just a single dependency is provided
363-
if (inherits(dependencies, "html_dependency")) {
364-
dependencies <- list(dependencies)
365-
}
366-
367-
# ensure we have a list of htmltools::htmlDependency
368-
is_dep <- vapply(dependencies, inherits, logical(1), "html_dependency")
369-
if (any(!is_dep)) {
370-
stop("`dependencies` must be a *list* of htmltools::htmlDependency objects", call. = FALSE)
371-
}
372-
373-
if (add) {
374-
dependencies <- c(private$dependencies_user, dependencies)
375-
}
376-
377-
private$dependencies_user <- dependencies
378-
},
379-
380340
react_version_set = function(version) {
381341
versions <- private$react_versions()
382342
idx <- versions %in% version
@@ -550,6 +510,38 @@ Dash <- R6::R6Class(
550510
# akin to https://github.com/plotly/dash/blob/d2ebc837/dash/dash.py#L338
551511
# note discussion here https://github.com/plotly/dash/blob/d2ebc837/dash/dash.py#L279-L284
552512
.index = NULL,
513+
514+
# ------------------------------------------------------------------------
515+
# HTML dependency management
516+
# ------------------------------------------------------------------------
517+
dependencies_get = function() {
518+
c(private$dependencies_user, private$dependencies)
519+
},
520+
dependencies_get_internal = function() {
521+
private$dependencies_internal
522+
},
523+
dependencies_set = function(dependencies = list(), add = TRUE) {
524+
525+
if (!length(dependencies)) return()
526+
527+
# do a sensible thing if just a single dependency is provided
528+
if (inherits(dependencies, "html_dependency")) {
529+
dependencies <- list(dependencies)
530+
}
531+
532+
# ensure we have a list of htmltools::htmlDependency
533+
is_dep <- vapply(dependencies, inherits, logical(1), "html_dependency")
534+
if (any(!is_dep)) {
535+
stop("`dependencies` must be a *list* of htmltools::htmlDependency objects", call. = FALSE)
536+
}
537+
538+
if (add) {
539+
dependencies <- c(private$dependencies_user, dependencies)
540+
}
541+
542+
private$dependencies_user <- dependencies
543+
},
544+
553545
index = function() {
554546
# collect and resolve dependencies
555547
depsAll <- compact(c(

0 commit comments

Comments
 (0)