Closed g41797 closed 4 months ago
Hey there, I'm not sure I fully understand what you're proposing.
Those expored functions are already just wrapper around existing functionalities. Take the Emailer.Send
you just added, the glue code is to handle the translation between goja types and Go's, that's mostly it.
I'm not sure I see the benefits of moving that glue code outside the function
package.
Maybe having a file in the function
package with all that glue code, removing it from runtime.go
, say something like exposed.go
(for lack of better word for now haha) and moving all those env.addX
there and have one function call from the Execute
function say: env.setuop()
or whatever.
This could be a nice refactor. Can you showcase what you're referring to by having them in their own package, can you give an example for instance of what could be customized?
Possibly separated package it too much Later I'll try to implement this staff in exposed.go
Current code for adding helper functions
Helper functions may be moved to separated package and added to functions registry via init()
Within Execute - add registered functions
Core code will be more clear
Also it will allow to add custom helper functions