Create a javascript callback that runs when shiny connects.
js_set_input_val.RdCreate a javascript callback that runs when shiny connects.
Arguments
- id
(chr)Automatically namespaced withnsif inside a module- value
(js)arbitrary js code that defines the value to bind. Can also be a variable name if declared in thejsargument- 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'}); };- ...
(additional named arguments)corresponding to any arguments that need be interpolated with glue- value_to
chrOne of:codeThe object will be treated as raw javascript code DefaultchrThe object will be treated as as JS character stringjsonThe object will be coerced withtoJSON
- asis
If
TRUE, use the ID as-is even when inside a module (instead of adding the namespace prefix to the ID).- as_callback
lglShould the resulting code be wrapped in a callback function?- on
chrA javascript event name, must be specified with a selector to argumenton_domthat indicates the jQuery selector for a DOM element to which the event will pertain.- as_tag
lglWhether the output should be a script tag.- .ns
funns function. Typically found automatically.- add_tag
lglwhether to enclose in a script tag
See also
Other JS:
js_after(),
js_callback(),
js_callout(),
js_glow(),
js_mouseover_once(),
use_driver.js()