The rgl
package exports a couple of htmlwidgets
: the one produced by rgl::rglwidget()
and the one produced by rgl::playwidget()
. In a separate package, I'd like to export some Javascript code that will work with these. (It will be a new control that can be handled by rgl::playwidget()
and will modify an rgl widget.)
So this code is much less than a widget; it won't ever be displayed on its own. It needs to have the rgl
code loaded first, and then it will add some rglwidgetClass
methods.
How should this be done? Is there a way to make an invisible widget, that just exists so that dependencies can be declared?
I don't know if this is the best way, but here is one way to do what I want.
The idea is that the htmltools
package allows you to attach dependencies to just about any HTML object that you're outputing. For example,
library(htmltools)
p("This is some text", htmlDependency( .... ))
will automatically cause the htmlDependency
to be loaded into the header of the created web page.