Decompress JSON data in Javascript

The R rgl package exports an HTML widget with the rglwidget() function, built using the htmlwidgets package. Often the data for this widget is quite large, and Pandoc and webshot2 choke on it.

I would like to try compressing the data when the HTML page is created, and uncompressing it in Javascript before display. I can see that there’s a Javascript package pako that appears to do what I want, and it can be “browserified”, but I can’t see how to make it available to rglwidget(). Can anyone describe what’s necessary?