Defines functions .onAttach

#'Utility Functions
#'Load the shiny drag and drop javascript dependencies
#'@import shiny htmltools
.onAttach <- function(...) {

	# register the js input handler to make the element reactive
	shiny::registerInputHandler("dragdropshiny.dropper", function(data,...) {
		if (is.null(data) | data == "")
	}, force = TRUE)

  # Create link to javascript and css files for package, referenced below
  shiny::addResourcePath("shinydnd", system.file("www", package = "shinyDND"))

# htmlDependency js and css will be used in other functions with attachDependency
shinyDNDDep = htmltools::htmlDependency("shinyDND", packageVersion("shinyDND"), 
	src = c("href" = "shinydnd"), script = "dragndrop.js", stylesheet = "dragndrop.css")

Try the shinyDND package in your browser

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

shinyDND documentation built on May 2, 2019, 6:52 a.m.