The hardware and bandwidth for this mirror is donated by dogado GmbH, the Webhosting and Full Service-Cloud Provider. Check out our Wordpress Tutorial.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]dogado.de.

d_js

Colin Fay

2023-06-05

Using {golem} js functions

{golem} comes with a series of JavaScript functions that you can call from the server. These functions are added by default with bundle_resources() .

Then they are called with golem::invoke_js("fonction", "ui_element").

This ui_element define the UI element to interact with. It can be a full jQuery selector, an id or a class. Note that you can add several elements and iterate other them.

invoke_js can be used with any function defined in a JavaScript Custom Handler, that you can build with golem::add_js_handler().

golem::invoke_js()

golem::invoke_js("showid", ns("plot"))
golem::invoke_js("showhref", "panel2")

See ?golem::activate_js() for the full list.

A quick intro to jQuery selectors

Note that in html, tags contains attributes. For example:

<a href = "https://thinkr.fr" data-value = "panel2">ThinkR</a>

contains href & data-value. You can refer to these attributes with [] after the tag name.

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.
Health stats visible at Monitor.