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

JS functions do not round trip through Generator templates #196

Open
cmars opened this issue May 3, 2022 · 2 comments
Open

JS functions do not round trip through Generator templates #196

cmars opened this issue May 3, 2022 · 2 comments

Comments

@cmars
Copy link
Contributor

cmars commented May 3, 2022

RE: loadFunctions, if you pass a Go value to a JS function and return it, it's likely that the generator template will be unable to access it's fields and methods.

The resulting object seems to be a goja.Object.

Options:

  • Wrap goja-dispatched functions with something that can unwrap an underlying type. If that's possible
  • Wrap goja return values with something that text/template can process (a map[string]interface{} maybe?)
  • Don't do anything, just document the behavior.

CC @mrded

@jcsackett
Copy link
Contributor

Given the funcmap being added, do we want to just document the behavior for js functions now? And maybe in said documentation recommend when to use which?

@cmars
Copy link
Contributor Author

cmars commented Jul 12, 2022

Sounds good to me!

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

2 participants