Create an anonymous JS function to monitor an event and bind it to a shiny input
js_callback.RdCreate an anonymous JS function to monitor an event and bind it to a shiny input
Usage
js_callback(id, js = "", value, ..., asis = FALSE, .ns = ns_find())Arguments
- id
(chr)Automatically namespaced withnsif inside a module- js
(chr)path to js file with just the anonymous function, or js code to interpolate into a generalized anonymous javascript function that uses glue insertions demarcated by{{}}:(e) => { console.log('{{input}} event'); {{js}} Shiny.setInputValue('{{input}}', {{value}}, {priority: 'event'}); };- value
(js)arbitrary js code that defines the value to bind. Can also be a variable name if declared in thejsargument- ...
(additional named arguments)corresponding to any arguments that need be interpolated with glue- asis
If
TRUE, use the ID as-is even when inside a module (instead of adding the namespace prefix to the ID).- .ns
funns function. Typically found automatically.
Value
(chr) with javascript interpolated with glue arguments
See also
Other JS:
js_after(),
js_callout(),
js_glow(),
js_mouseover_once(),
js_set_input_val(),
use_driver.js()