Comments (3)
It's 'fetch's issue. Look at its API.
from goja.
Judging by the error you tried something like this:
vm.Set("self", map[string]interface{}{})
You definitely don't want to do this. It creates a JS wrapper around the map and every time you put a JS value into it, the value will be Export()'ed and then every time you reference it from JS it will be wrapped again. (Aside of this, the reason for the error is those wrapped maps are not extensible by default. Can't remember if there was a good reason for me to do it this way, probably not, I'll change it).
If you want to set it to an empty object it could be done like this:
vm.Set("self", vm.NewObject())
However, in browsers 'self' appears to be the global object, so to make it more compatible you should do the same. I'll probably add something like vm.GlobalObject(), but for now you can do this:
vm.RunString("var self = this")
from goja.
That's very interesting! I will definitely try this.
from goja.
Related Issues (20)
- Posibility to access goja bytecode and native fields of compiled programs HOT 1
- run javascript long time HOT 1
- Runtime is nil in func(goja.FunctionCall, goja.Runtime) goja.Value
- Issue when compiling typescript 5.0 compiler HOT 8
- Store object using SharedDynamicObject HOT 1
- Implement async/await syntax HOT 19
- Functions defined in js eventually be released safely? HOT 1
- Question:Why JSON.parse of goja doesn't use json.Unmarshal in the golang standard library? HOT 1
- Buffer is not defined HOT 2
- new Date().toString() returns shortened timezone HOT 2
- AssertFunction fails for object.function_name HOT 2
- Wrapping map in a type breaks toValue after 6c0d9883792e42e6da320ac03ae0d6c1b0cd7530 HOT 2
- Error parsing typescript 5 compiler code with goja
- A problem with AsyncContextTracker HOT 5
- Can I do `sleep` and can I generate random numbers? HOT 1
- `AsyncContextTracker.Resumed` not called if returning from an async function HOT 9
- Modifying objects in javascript fails silently HOT 5
- Object not being added to array as expected HOT 7
- Stack incorrect after recursive RunProgram calls HOT 2
- Modify nodes and export new JS code HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from goja.