rogchap / v8go

Execute JavaScript from Go
https://rogchap.com/v8go
BSD 3-Clause "New" or "Revised" License
3.21k stars 221 forks source link

Question: Accessing global variables after each script execution #366

Open mustafaakin opened 1 year ago

mustafaakin commented 1 year ago

I'm trying to build Jupyter-notebook like application with v8 isolates. I'm writing it in Go, but I know it's not specfic to Go, but V8 isolates.

Consider I run the following code:

let users = [1,2,3]
let mappedUsers = users.map(a => a*3)

After this execution, how can I access these variables created globally, meaning I don't know the script contents so how can I iterate them properly? This might be a debugger case, and I might be confusing some use cases, but any pointers would be appreciated.

silentiumNoxe commented 1 year ago

exec js return users return mappedUsers