-
Notifications
You must be signed in to change notification settings - Fork 62
Description
Is there a way to use this library akin to how something like Goja or Otto usage looks like? I'm working on a CLI where I want to have a JS runtime that will run perhaps many scripts (both files and from variables in go) in the same context. Right now I'm using Otto, and it works, but I'd like something that supports ES6 (especially modules). Here's an example of what I'm doing to setup a vm:
vm := otto.New()
err = vm.Set("someFunc", func(call otto.FunctionCall) otto.Value {
message := call.Argument(0).String()
// some go code here
return otto.Value{}
})
_, err := vm.Run(` // some setup scripts `);
Then later I have some user-defined scripts I want to execute against that vm (via the Run
method), using some of those pre-defined setup/functions and interop as necessary. It doesn't look like this is something Elsa currently can handle, but is this a direction you're going in? If not I have some other options, just none as attractive as what you're doing here I think.
Thanks in advance, and best of luck!