Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed May 14, 2018
0 parents commit f7c5e19
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 0 deletions.
31 changes: 31 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
4 changes: 4 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import * as ts from "typescript";


V8Worker2.print("Hello World", ts.createProgram);
8 changes: 8 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "deno",
"dependencies": {},
"devDependencies": {
"parcel-bundler": "^1.8.1",
"typescript": "^2.8.3"
}
}
23 changes: 23 additions & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"noImplicitAny": true,
"sourceMap": true,
"removeComments": true,
"preserveConstEnums": true,
"declaration": true,
"target": "es5",
"lib": ["es2015", "dom"],
"noEmit": true,
"noUnusedLocals": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"alwaysStrict": true,
"noUnusedParameters": false,
"pretty": true,
"noFallthroughCasesInSwitch": true,
"allowUnreachableCode": false,
"experimentalDecorators": true
},
"include": ["*.ts"]
}

0 comments on commit f7c5e19

Please sign in to comment.