Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

onRender should support more than a bare function #326

Closed
cpsievert opened this issue Feb 4, 2019 · 1 comment
Closed

onRender should support more than a bare function #326

cpsievert opened this issue Feb 4, 2019 · 1 comment

Comments

@cpsievert
Copy link
Collaborator

cpsievert commented Feb 4, 2019

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);

@cpsievert
Copy link
Collaborator Author

Closing in favor of the more specific #329

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant