Merge pull request #881 from trheyi/main
Improve JavaScript argument handling in jsCall method
This commit is contained in:
commit
125876d5ef
1 changed files with 19 additions and 18 deletions
|
|
@ -188,11 +188,10 @@ func jsCall(info *v8go.FunctionCallbackInfo) *v8go.Value {
|
|||
|
||||
// Rest args
|
||||
var jsArgs *v8go.Value
|
||||
goArgs := []interface{}{}
|
||||
if len(args) > 3 {
|
||||
jsArgs = args[3]
|
||||
}
|
||||
|
||||
goArgs := []interface{}{}
|
||||
if jsArgs != nil {
|
||||
if jsArgs.IsArray() {
|
||||
v, err := bridge.GoValue(jsArgs, info.Context())
|
||||
if err != nil {
|
||||
|
|
@ -210,6 +209,8 @@ func jsCall(info *v8go.FunctionCallbackInfo) *v8go.Value {
|
|||
}
|
||||
goArgs = []interface{}{v}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Parse the callback
|
||||
funcType := "method"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue