summaryrefslogtreecommitdiff
path: root/main.go
diff options
context:
space:
mode:
Diffstat (limited to 'main.go')
-rw-r--r--main.go31
1 files changed, 31 insertions, 0 deletions
diff --git a/main.go b/main.go
new file mode 100644
index 000000000..b3a3e8874
--- /dev/null
+++ b/main.go
@@ -0,0 +1,31 @@
+// 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)
+ }
+}