/
includes.R
73 lines (72 loc) · 1.68 KB
/
includes.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
#' Included package scripts
#'
#' Include Dexie and the package script in the header
#'
#' @return Initialize the storage by including scripts necessary for the persistent storage handling
#' @examples
#' \donttest{
#' library(shiny)
#' library(shinyStorePlus)
#'
#' if (interactive()) {
#' ui <- shiny::fluidPage(
#' # initialize stores
#' initStore(),
#' titlePanel("Sample
#' shinyStorePlus Init Inputs"),
#' sidebarLayout(
#' sidebarPanel(
#' sliderInput("nextgenshinyapps1",
#' "Number of bins:",
#' min = 1,
#' max = 200,
#' value = 150
#' ),
#' textInput(
#' "caption",
#' "simple caption:",
#' "summary, try editing"
#' ),
#' numericInput("obs",
#' "sample observations:",
#' 10,
#' min = 1, max = 100
#' )
#' ),
#' mainPanel(
#' plotOutput("distPlot")
#' )
#' )
#' )
#' server <- function(input, output, session) {
#' output$distPlot <- renderPlot({
#' x <- faithful[, 2]
#' bins <- seq(min(x),
#' max(x),
#' length.out =
#' input$nextgenshinyapps1 + 1
#' )
#' hist(x,
#' breaks = bins,
#' col = "blue",
#' border = "gray"
#' )
#' })
#' }
#' shiny::shinyApp(ui = ui, server = server)
#' }
#' }
#'
#' @export
#'
initStore <- function() {
ssp <- "shinyStorePlus"
vs <- "1.1"
template.loc1 <- file.path(find.package(package = ssp), "scripts")
htmltools::htmlDependency(
ssp, vs,
src = template.loc1,
script = c("dexie.js", paste0(tolower(ssp), ".js")),
all_files = FALSE
)
}