mirror of
https://github.com/denoland/deno.git
synced 2024-11-21 20:38:55 +00:00
32 lines
551 B
Go
32 lines
551 B
Go
// To test: make && ./out/render test_input.js
|
|
package main
|
|
|
|
//go:generate go-bindata -pkg $GOPACKAGE -o assets.go dist/
|
|
|
|
import (
|
|
"github.com/ry/v8worker2"
|
|
)
|
|
|
|
func recv(msg []byte) []byte {
|
|
println("recv cb", string(msg))
|
|
return nil
|
|
}
|
|
|
|
func main() {
|
|
indexFn := "dist/main.js"
|
|
data, err := Asset(indexFn)
|
|
if err != nil {
|
|
panic("asset not found")
|
|
}
|
|
code := string(data)
|
|
|
|
worker := v8worker2.New(recv)
|
|
|
|
// Load up index.js code.
|
|
err = worker.Load(indexFn, code)
|
|
if err != nil {
|
|
println("Problem executing Javascript.")
|
|
panic(err)
|
|
}
|
|
}
|