Merge pull request #881 from trheyi/main

Improve JavaScript argument handling in jsCall method
This commit is contained in:
Max 2025-02-27 15:16:00 +08:00 committed by GitHub
commit 125876d5ef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -188,11 +188,10 @@ func jsCall(info *v8go.FunctionCallbackInfo) *v8go.Value {
// Rest args // Rest args
var jsArgs *v8go.Value var jsArgs *v8go.Value
goArgs := []interface{}{}
if len(args) > 3 { if len(args) > 3 {
jsArgs = args[3] jsArgs = args[3]
} if jsArgs != nil {
goArgs := []interface{}{}
if jsArgs.IsArray() { if jsArgs.IsArray() {
v, err := bridge.GoValue(jsArgs, info.Context()) v, err := bridge.GoValue(jsArgs, info.Context())
if err != nil { if err != nil {
@ -210,6 +209,8 @@ func jsCall(info *v8go.FunctionCallbackInfo) *v8go.Value {
} }
goArgs = []interface{}{v} goArgs = []interface{}{v}
} }
}
}
// Parse the callback // Parse the callback
funcType := "method" funcType := "method"