inst/template/R/input-handlers.R

#---------------------------------------------#
# DO NOT EDIT THIS FILE OR ADD ANYTHING TO IT #
#---------------------------------------------#

#' Input Dataframe
#' 
#' Converts the input received from the WebSocket
#' to a data.frame.
#' 
#' @param data Input data received from WebSocket.
#' 
#' @keywords internal
leprechaun_handler_df <- function(data){
	do.call("rbind", lapply(data))
}

#' Input List
#' 
#' Forces the input received from the WebSocket 
#' to a list. This should really not be needed as
#' it is handled like so by default.
#' 
#' @param data Input data received from WebSocket.
#' 
#' @keywords internal
leprechaun_handler_list <- function(data){
	return(data)
}

.onAttach <- function(...) {
	shiny::registerInputHandler(
		"#PKGNAME#.list", 
		leprechaun_handler_list, 
		force = TRUE
	)

	shiny::registerInputHandler(
		"#PKGNAME#.df", 
		leprechaun_handler_df, 
		force = TRUE
	)
}

#---------------------------------------------#
# DO NOT EDIT THIS FILE OR ADD ANYTHING TO IT #
#---------------------------------------------#

Try the leprechaun package in your browser

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

leprechaun documentation built on Jan. 19, 2022, 5:08 p.m.