Create a new Javascript function for adding to a NGCHM menu.
Source:R/functions.R
chmNewFunction.Rd
This function creates a new Javascript function object for adding to a Next Generation Clustered Heat Map menu.
Usage
chmNewFunction(
name,
description,
implementation,
extraParams = NULL,
requires = NULL,
global = FALSE
)
Arguments
- name
The name of the Javascript function
- description
A short description of the Javascript function
- implementation
A string containing the javascript code required to define the function. When called the function is passed a list of selected values (e.g. labels). Additional parameters can be declared before the values parameter and must be resolved through currying (binding) before the function is used in menus.
- extraParams
An optional list of extra parameters. (Default NULL.)
- requires
An optional vector of (custom) Javascript function names that this function requires.
- global
A logical: TRUE if should be defined globally, not within a customization section. (Default FALSE.)
Examples
alertFn <- chmNewFunction("showAlert", "Display the parameter in an alert box",
"function showAlert(label) { alert(label); }",
global = TRUE
)
dbLookup <- chmNewFunction(
"dbLookup", "Lookup the parameter in a database",
"function showAlert(database, label) { alert(database[label]); }",
c("database")
)