Checks whether a specific dependency is already inserted in the UI with this function, and performs the insert if necessary.
Usage
with_js(package, src, script, session = shiny::getDefaultReactiveDomain())Details
The function is designed to be called from another function creating/updating a widget that requires JavaScript. With this, the user does not need to manage the dependency manually.
When session is NULL, the function will return without doing anything.
This is useful when the function is called from ui side. The JavaScript
dependency will be attached next time the function is called from server side.
This is because the session$userData object cannot be updated from ui side.
Details about src can be found in htmlDependency.
Examples
if (FALSE) { # \dontrun{
with_js(package = "ktag", src = "assets", script = "js/ktag.js",
session = shiny::getDefaultReactiveDomain())
} # }