Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

JSEvals

Creates a list of keys whose values need to be evaluated on the client-side


Description

It works by transforming list(foo = list(1, list(bar = I('function(){}')), 2)) to list("foo.2.bar"). Later on the JS side, the window.HTMLWidgets.evaluateStringMember function is called with the JSON object and the "foo.2.bar" string, which is split to ['foo', '2', 'bar'], and the string at that location is replaced in-situ with the results of evaluating it. Note '2' (character) should have been 2 (integer) but it does not seem to matter in JS: x[2] is the same as x['2'] when all child members of x are unnamed, and ('2' in x) will be true even if x is an array without names. This is a little hackish.

Usage

JSEvals(list)

Arguments

list

a list in which the elements that should be evaluated as JavaScript are to be identified

Details

This function is intended mostly for internal use. There's generally no need for widget authors or users to call it, as it's called automatically on the widget instance data during rendering. It's exported in case other packages want to add support for JS in contexts outside of widget payloads.

Author(s)

Yihui Xie


htmlwidgets

HTML Widgets for R

v1.5.3
MIT + file LICENSE
Authors
Ramnath Vaidyanathan [aut, cph], Yihui Xie [aut], JJ Allaire [aut], Joe Cheng [aut], Carson Sievert [aut, cre] (<https://orcid.org/0000-0002-4958-2844>), Kenton Russell [aut, cph], Ellis Hughes [ctb], RStudio [cph]
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.