ThinkR-open / golem
Showing 1 of 3 files from the diff.
Other files ignored by Codecov
NAMESPACE has changed.

@@ -119,20 +119,14 @@
Loading
119 119
      } else {
120 120
        write_there("#' @noRd ") 
121 121
      }
122 -
      write_there(sprintf("mod_%s_server_core <- function(input, output, session){", name))
123 -
      write_there("  ns <- session$ns")
122 +
      write_there(sprintf("mod_%s_server <- function(id){", name))
123 +
      write_there("  moduleServer( id, function(input, output, session){")
124 +
      write_there("    ns <- session$ns")
124 125
      write_there(ph_server)
126 +
      write_there("  })")
125 127
      write_there("}")
126 128
      write_there("    ")
127 129
      
128 -
      write_there("#' @importFrom golem moduleServer")
129 -
      write_there(sprintf("mod_%s_server <- function(id){", name))
130 -
      write_there("  moduleServer(")
131 -
      write_there("    id,")
132 -
      write_there(sprintf("    mod_%s_server_core", name))
133 -
      write_there("  )")
134 -
      write_there("}")
135 -
      
136 130
      write_there("## To be copied in the UI")
137 131
      write_there(sprintf('# mod_%s_ui("%s_ui_1")', name, name))
138 132
      write_there("    ")
@@ -152,53 +146,57 @@
Loading
152 146
  }
153 147
}
154 148
155 -
#' shim for moduleServer
156 -
#' 
157 -
#' This function is a shim for `shiny::moduleServer` that allows passing 
158 -
#' arguments via `...`
159 -
#'
160 -
#' @inheritParams shiny::moduleServer
161 -
#' @param ... Arguments to pass to the module server function when it's defined outside of `moduleServer()`
162 -
#'
163 -
#' @return The return value, if any, from executing the module server function
164 -
#' 
165 -
#' @export
166 -
#'
167 -
#' @examples
168 -
#' name_ui <- function(id){
169 -
#' ns <- NS(id)
170 -
#' tagList(
171 -
#'   actionButton(ns("go"), "go")
172 -
#' )
173 -
#' }
174 -
#' 
175 -
#' name_server_core <- function(input, output, session, arg) {
176 -
#'   observeEvent( input$go , {
177 -
#'     print(arg)
178 -
#'   })
179 -
#' }
180 -
#' 
181 -
#' name_server <- function(id, arg) {
182 -
#'   moduleServer(
183 -
#'    id,
184 -
#'    name_server_core, 
185 -
#'    arg = arg
186 -
#'   )
187 -
#' }
188 -
moduleServer <- function(
189 -
  id, 
190 -
  module, 
191 -
  ...,
192 -
  session = getDefaultReactiveDomain()
193 -
) {
194 -
  if (inherits(session, "MockShinySession")) {
195 -
    body(module) <- rlang::expr({
196 -
      session$setEnv(base::environment())
197 -
      !!body(module)
198 -
    })
199 -
    session$setReturned(callModule(module, id, session = session, ...))
200 -
  }
201 -
  else {
202 -
    callModule(module, id, session = session, ...)
203 -
  }
204 -
}
149 +
# This is an idea for shiming moduleServer from {shiny} so that 
150 +
# the server infrastructure is not 
151 +
# 
152 +
# #' shim for moduleServer
153 +
# #' 
154 +
# #' This function is a shim for `shiny::moduleServer` that allows passing 
155 +
# #' arguments via `...`
156 +
# #'
157 +
# #' @inheritParams shiny::moduleServer
158 +
# #' @param ... Arguments to pass to the module server function when it's defined outside of `moduleServer()`
159 +
# #'
160 +
# #' @return The return value, if any, from executing the module server function
161 +
# #' 
162 +
# #' @export
163 +
# #'
164 +
# #' @examples
165 +
# #' name_ui <- function(id){
166 +
# #' ns <- NS(id)
167 +
# #' tagList(
168 +
# #'   actionButton(ns("go"), "go")
169 +
# #' )
170 +
# #' }
171 +
# #' 
172 +
# #' name_server_core <- function(input, output, session, arg) {
173 +
# #'   observeEvent( input$go , {
174 +
# #'     print(arg)
175 +
# #'   })
176 +
# #' }
177 +
# #' 
178 +
# #' name_server <- function(id, arg) {
179 +
# #'   moduleServer(
180 +
# #'    id,
181 +
# #'    name_server_core, 
182 +
# #'    arg = arg
183 +
# #'   )
184 +
# #' }
185 +
# moduleServer <- function(
186 +
#   id, 
187 +
#   module, 
188 +
#   ...,
189 +
#   session = getDefaultReactiveDomain()
190 +
# ) {
191 +
#   if (inherits(session, "MockShinySession")) {
192 +
#     body(module) <- rlang::expr({
193 +
#       session$setEnv(base::environment())
194 +
#       !!body(module)
195 +
#     })
196 +
#     session$setReturned(callModule(module, id, session = session, ...))
197 +
#   }
198 +
#   else {
199 +
#     callModule(module, id, session = session, ...)
200 +
#   }
201 +
# }
202 +
# 
Files Coverage
R 70.24%
Project Totals (26 files) 70.24%
1
comment: false
2

3
coverage:
4
  status:
5
    project:
6
      default:
7
        target: auto
8
        threshold: 1%
9
    patch:
10
      default:
11
        target: auto
12
        threshold: 1%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading