include.R 849 B

12345678910111213141516171819202122232425262728293031
  1. #' Include JsBarcode JS Script
  2. #' @param cdn Indicate whether to get JsBarcode from CDN or server
  3. #' @importFrom shiny includeScript tagList singleton
  4. #' @export
  5. includeJsBarcode <- function(cdn = FALSE) {
  6. if (cdn) {
  7. shiny::singleton(shiny::tagList(
  8. shiny::includeScript(
  9. "https://cdn.jsdelivr.net/jsbarcode/3.5.8/JsBarcode.all.min.js"
  10. ),
  11. shiny::includeScript(
  12. system.file(package = "shinyBarcode", "javascript", "shinyBarcode.js")
  13. )
  14. ))
  15. } else {
  16. shiny::singleton(shiny::tagList(
  17. shiny::includeScript(
  18. system.file(
  19. package = "shinyBarcode",
  20. "javascript",
  21. "JsBarcode",
  22. "JsBarcode.all.min.js"
  23. )
  24. ),
  25. shiny::includeScript(
  26. system.file(package = "shinyBarcode", "javascript", "shinyBarcode.js")
  27. )
  28. ))
  29. }
  30. }