Get support for Genentech/battery
If you're new to LTH, please see our FAQ for more information on what it is we do.
Qualified Helpers
Genentech/battery
R6Class based component architecture framework for Shiny apps
The components design is based on AngularJS that can emit event from root it it's children and broadcast events from child to parents. It give better structure of non trivial shiny apps, that need to have lots of different parts.
Installation
git clone https://github.com/Genentech/battery.git
R CMD INSTALL battery
Basic usage
Button <- battery::component(
classname = "Button",
label = NULL,
constructor = function(label = NULL) {
self$label = label
},
render = function() {
shiny::tags$button(self$label)
}
)
App <- battery::component(
classname = "App",
public = list(
constructor = function() {
btn <- Button$new(label = "Click me", parent = self, component.name = "button")
self$output[[ self$ns("root") ]] <- shiny::renderUI({
shiny::tags$div(
shiny::tags$p("click the button"),
btn$render()
)
})
},
render = function() {
tags$div(
titlePanel('Shiny App using Battery R package'),
mainPanel(shiny::uiOutput(self$ns("root")))
)
}
)
)
Documentation
For full documentation see Battery Components Vignette.
You can also read tutorial about the framework features at DEV.to: Architecture for Non-Trivial R Shiny Applications
Contributors
- Jakub T. Jankiewicz - main author
- MichaĆ Jakubczak
License
Copyright (c) 2019-2021 Genentech, Inc. Released under MIT license
Our Mission
We want to make open source more sustainable. The entire platform was born from this and everything we do is in aid of this.
From the Blog
Interesting Articles
-
Generating income from open source
Jun 23 • 8 min read
-
2023 State of OSS
Apr 23 • 45 min read ★
-
A funding experiment...
Aug 19 • 10 min read
-
But You Said I could
Aug 19 • 2 min read
Thank you for checking out LiveTechHelper |
2024 © lth-dev incorporated
p-e622a1a2