Skip to content

Commit

Permalink
Add Go <=> JavaScript type interaction
Browse files Browse the repository at this point in the history
Via reflection for struct, map, and slice/array
Fix robertkrimen#10
  • Loading branch information
robertkrimen committed Feb 4, 2013
1 parent 96601bf commit a879744
Show file tree
Hide file tree
Showing 17 changed files with 1,447 additions and 48 deletions.
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ TEST := -v --run RegExp_exec
TEST := -v --run _panic
TEST := -v --run TransformRegExp
TEST := -v --run Lexer
TEST := -v --run Reflect
TEST := -v --run _reflectSlice
TEST := -v --run _reflect
TEST := .

test: test-i
Expand Down
8 changes: 7 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Embedding a Go function in JavaScript:

Otto.Set("twoPlus", func(call otto.FunctionCall) otto.Value {
right, _ := call.Argument(0).ToInteger()
result, _ := otto.ToValue(2 + right)
result, _ := Otto.ToValue(2 + right)
return result
})

Expand Down Expand Up @@ -280,6 +280,12 @@ conversion failing), then an error is returned.

If the top-level binding does not exist, it will be created.

#### func (Otto) ToValue

```go
func (self Otto) ToValue(value interface{}) (Value, error)
```

#### type Value

```go
Expand Down
7 changes: 7 additions & 0 deletions dbg.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package otto

import (
Dbg "github.com/robertkrimen/otto/dbg"
)

var dbg, dbgf = Dbg.New()
Loading

0 comments on commit a879744

Please sign in to comment.