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

frameableWidget

Adds pymjs initialization code to a htmlwidget.


Description

This function augments a htmlwidget so that when saved, the resulting HTML document can be rendered correctly inside a responsive iframe (created using Pym.js) of another HTML document.

Usage

frameableWidget(widget, renderCallback = NULL)

Arguments

widget

The widget to add the pymjs code to.

renderCallback

An optional Javascript function wrapped in JS() which will be called when parent sends a resize event.

Details

Generate your htmlwidget in the normal way and then call this function passing in your widget. Then call saveWidget() and the saved HTML file is now embeddable inside a Pym.js iframe of another HTML document. See Pym.js documentation on how to create an HTML document with a responsive iframe.

See Also

Examples

## Not run: 
library(leaflet)
l <- leaflet() %>% addTiles() %>% setView(0,0,1)
htmlwidgets::saveWidget(
  widgetframe::frameableWidget(l),'some-directory-on-your-disk')

## End(Not run)

widgetframe

'Htmlwidgets' in Responsive 'iframes'

v0.3.1
MIT + file LICENSE
Authors
Bhaskar Karambelkar [aut, cre], Yihui Xie [ctb], NPR Visual Team [ctb, cph] (pym.js JavaScript library), Bjørn Klinggaard [ctb, cph] (bLazy.js JavaScript library)
Initial release

We don't support your browser anymore

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