R/zzz.R

Defines functions .onLoad

#' @importFrom shiny registerInputHandler
#' @noRd
.onLoad <- function(libname, pkgname){
  shiny::registerInputHandler("jsTreeR.list", function(data, ...){
    data
  }, force = TRUE)
  shiny::registerInputHandler("jsTreeR.move", function(data, ...){
    lapply(data, unlist)
  }, force = TRUE)
  shiny::registerInputHandler("jsTreeR.copied", function(data, ...){
    data[["from"]][["path"]] <- unlist(data[["from"]][["path"]])
    data[["to"]][["path"]] <- unlist(data[["to"]][["path"]])
    data
  }, force = TRUE)
  shiny::registerInputHandler("jsTreeR.path", function(data, ...){
    data[["path"]] <- unlist(data[["path"]])
    data
  }, force = TRUE)
}

Try the jsTreeR package in your browser

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

jsTreeR documentation built on July 4, 2024, 9:08 a.m.