Comments (2)
The code fails because you're running it in an 'empty' runtime that you have created, rather than the loop runtime which is provided as the argument to the function you're running in the loop, i.e. it should be
func main() {
loop := eventloop.NewEventLoop()
loop.Run(func(vm *goja.Runtime) {
vm.RunString(`
console.log("Hello World")
`)
})
}
from goja_nodejs.
The code fails because you're running it in an 'empty' runtime that you have created, rather than the loop runtime which is provided as the argument to the function you're running in the loop, i.e. it should be
func main() { loop := eventloop.NewEventLoop() loop.Run(func(vm *goja.Runtime) { vm.RunString(` console.log("Hello World") `) }) }
Oh. You're right. I didn't even see that. Thank you!
from goja_nodejs.
Related Issues (20)
- Is goja-node still being maintained HOT 2
- eventloop: Aux jobs sometimes run on stopped loop HOT 2
- require: loading of directory modules is broken in windows HOT 1
- goja.Parse HOT 1
- Need contribution guidelines
- Need community channels HOT 1
- I need await/sync syntax, can give some suggestions? HOT 2
- Misleading error message when registry is not enabled
- Support for `process.env`? HOT 4
- `require('./util')` will return the "native module" that register by `goja_nodejs/util/module.go`, expect is my `util.js` file. HOT 1
- NodeJS URL Support
- Prioritise native modules HOT 2
- Performance issue due to native modules being lower priority HOT 1
- setImmediate support HOT 1
- No way to interrupt a script running EventLoop HOT 3
- could you help me understand the example on README HOT 1
- Docs Request
- [Feature]: Support Path module
- how to return valuein eventloop? 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_nodejs.