You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Once {tidymodules} is on CRAN (end of year?), we would like to know if you are interested to add a parameter to the add_module function so that it creates a R6 class template instead of the default.
We can develop the feature for you.
An example of what it could produce:
# module R6Class ---------------------------------#' R6 Class representing the module#'#' @description#' UI and server code necessary for the module#' @details#' More details#'#' @exportmodule<-R6::R6Class(
"module",
inherit=tidymodules::TidyModule,
public=list(
#' @field nested_mod nested modules. This is updated by the initialize function.nested_mod=list(),
#' @description#' Module initialization#' @param ... NULL by default.#' @return A new `module` object.initialize=function(...) {
super$initialize(...)
# initialize nested modules# self$nested_mod[[1]] <- Nested$new(inherit = TRUE)# define portsself$definePort({
self$addInputPort(
name="iport1",
description="My beautiful input",
sample=list()
)
self$addOutputPort(
name="oport1",
description="My uggly output",
sample= tibble()
)
})
},
#' @description#' Create the module UI#' @return ...ui=function() {
tagList(
# UI elements go here
)
},
#' @description#' Server function description#' @param input Shiny input object.#' @param output Shiny output object.#' @param session Shiny session object.#' @return The server function.server=function(input, output, session) {
super$server(input, output, session)
# call all nasted modules below# self$nested_mod[[1]]$callModule()# update output portsself$assignPort({
# self$updateOutputPort(...)
})
}
)
)
The text was updated successfully, but these errors were encountered:
I think the safe way to do that would be through the idea of golem templating.
In order to implement that feature, one thing I can imagine would be to have a "module template" function that returns the content of the module you want to create, in the spirit of add_module(name = "bla", template = tidymodules::module_template).
In my opinion that would be the best way to go for the following reasons:
you can keep your "freedom" for the format, meaning that if at some point the tidy module templates changes, you can change it inside the package instead of having to PR-ing golem, which would result in a potential version mismatch if a new version of golem is released long after a new version of tidymodules
that template format can be bootstrapped to other module formats, as long as the function returns what's needed, golem stays agnostic
in a sense, a tidymodules template function would work even outside golem
Hi All,
Once {tidymodules} is on CRAN (end of year?), we would like to know if you are interested to add a parameter to the add_module function so that it creates a R6 class template instead of the default.
We can develop the feature for you.
An example of what it could produce:
The text was updated successfully, but these errors were encountered: