R/options.R

Defines functions get_toolkit_option toolkit_option

Documented in get_toolkit_option toolkit_option

#' @rdname jd3_utilities
#' @export
.jd3_env <- new.env()

#' @title Set an option for toolkit
#'
#' @param name Name of the option
#' @param obj Option
#'
#' @returns Invisibly `NULL`
#'
#' @export
#'
#' @examples
#' toolkit_option("test", "DUMMY")
toolkit_option <- function(name, obj) {
    options_tk <- .jd3_env$toolkit
    options_tk[[name]] <- obj
    assign("toolkit", options_tk, .jd3_env)
    return(invisible(NULL))
}

#' @title Get the value of an option for toolkit
#'
#' @param name Name of the option
#'
#' @returns The requested option or NULL if it doesn't exist
#' @export
#'
#' @examples
#' toolkit_option("test", "DUMMY")
#' get_toolkit_option("test")
get_toolkit_option <- function(name) {
    options_tk <- .jd3_env$toolkit
    return(options_tk[[name]])
}

Try the rjd3toolkit package in your browser

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

rjd3toolkit documentation built on Sept. 21, 2026, 5:06 p.m.