go-v8
go-v8 copied to clipboard
Communication between VMs
Go-v8 is seemingly working great, but it seems to be missing features that would make it useful to real apps like adding functions to existing JS objects, or prototypes, or returning Go objects to JS or any way to give JS a type of application context.
If I want to use JS as a scripting language for things that really run in Go I need to create objects from JS but actually exist in Go. What is passed back to JS could be a pointer or a duplicate representation but I'm not understanding how I can do anything more than basic function calls with what is provided.
I would like to recreate some of the features that the browser has but I can't imagine how I would enable something like this.
var image = new Image()
image.onload = function(){
console.log(image.width)
}
image.src = "path to image"
In this example the Image object would have to be something in Go. That object could be constructed and would have to be able to be modified like how the onload is added. The image.src is really a setter, that starts the load and the width is really only populated after the image is loaded.
Are there future plans for adding other types of interaction? Are there other projects in other languages that maybe I can help port over? Or maybe I am missing something and all of this is possible with what is already created and I am missing something?
After reading more https://developers.google.com/v8/embed it looks like go-v8 is missing accesssors, interceptors, and a shadow object model for objects that are accessible in both VMs. I will try to implement what I can but if you have a clear idea of how it should work please let me know.