Create a javascript callback that runs when shiny connects.
js_set_input_val.Rd
Create a javascript callback that runs when shiny connects.
Arguments
- id
(chr)
Automatically namespaced withns
if inside a module- value
(js)
arbitrary js code that defines the value to bind. Can also be a variable name if declared in thejs
argument- 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
chr
One of:code
The object will be treated as raw javascript code Defaultchr
The object will be treated as as JS character stringjson
The 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
lgl
Should the resulting code be wrapped in a callback function?- on
chr
A javascript event name, must be specified with a selector to argumenton_dom
that indicates the jQuery selector for a DOM element to which the event will pertain.- as_tag
lgl
Whether the output should be a script tag.- .ns
fun
ns function. Typically found automatically.- add_tag
lgl
whether to enclose in a script tag
See also
Other JS:
js_after()
,
js_callback()
,
js_callout()
,
js_glow()
,
js_mouseover_once()
,
use_driver.js()