R/pwa-dependencies.R

Defines functions add_pwa_deps

Documented in add_pwa_deps

#' PWA dependencies utils
#'
#' @description This function attaches PWA manifest and icons to the given tag
#'
#' @param tag Element to attach the dependencies.
#'
#' @importFrom utils packageVersion
#' @importFrom htmltools tagList htmlDependency
#' @keywords internal
add_pwa_deps <- function(tag) {
  pwa_deps <- htmlDependency(
    name = "pwa-utils",
    version = packageVersion("shinyMobile"),
    src = c(file = sprintf("shinyMobile-%s", packageVersion("shinyMobile"))),
    head = "<link rel=\"manifest\" href=\"manifest.webmanifest\" />
<link rel=\"icon\" type=\"image/png\" href=\"icons/icon-144.png\" sizes=\"144x144\" />
<link rel=\"apple-touch-icon\" href=\"icons/apple-touch-icon.png\" />
<link rel=\"icon\" href=\"icons/favicon.png\"/>
  ",
    package = "shinyMobile",
  )
  tagList(tag, pwa_deps)
}

Try the shinyMobile package in your browser

Any scripts or data that you put into this service are public.

shinyMobile documentation built on Oct. 5, 2024, 1:07 a.m.