Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print Text from inside the VM #116

Closed
CryptoCopter opened this issue Nov 21, 2019 · 2 comments
Closed

Print Text from inside the VM #116

CryptoCopter opened this issue Nov 21, 2019 · 2 comments

Comments

@CryptoCopter
Copy link

CryptoCopter commented Nov 21, 2019

Hello,

is it possible to print text/write to stdout from within the vm? I've tried using console.log but that just results in a ReferenceError.

Right now, my workaround is to pass a Go function func loggingFunc(message string) to the vm which then just prints the message. But is there a better way?

@dop251
Copy link
Owner

dop251 commented Nov 22, 2019

You can also use the console module from goja_nodejs:

import "github.com/dop251/goja_nodejs/console"
...
console.Enable(gojaRuntime)

@CryptoCopter
Copy link
Author

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants