I'd expect this to work, but it currently doesn't:
library(plotly)
library(reactR)
plot_ly() %>%
onRender(babel_transform("gd => console.log(gd)"))
That's because babel_transform() doesn't return a bare function:
cat(babel_transform("gd => console.log(gd)"))
"use strict";
(function (gd) {
return console.log(gd);
});
However, HTMLWidgets.evalAndRun assumes we're passing a bare function:
|
var taskFunc = eval("(" + task + ")"); |
Seems as though we could support this use case by also trying var taskFunc = eval(task);
I'd expect this to work, but it currently doesn't:
That's because
babel_transform()doesn't return a bare function:cat(babel_transform("gd => console.log(gd)"))However,
HTMLWidgets.evalAndRunassumes we're passing a bare function:htmlwidgets/inst/www/htmlwidgets.js
Line 236 in 5db27ad
Seems as though we could support this use case by also trying
var taskFunc = eval(task);