mirror of
https://github.com/wavetermdev/wails.git
synced 2026-08-05 13:53:43 -07:00
[v3] Binding runtime fixes (#3431)
* Unmarshal arguments to appropriate type in binding calls * Marshal multiple return values to arrays in binding calls * Improve logging of remote method calls * Add tests for `BoundMethod.Call` * Fix return value if error is nil * Update changelog --------- Co-authored-by: Andreas Bichinger <andreas.bichinger@gmail.com>
This commit is contained in:
co-authored by
Andreas Bichinger
parent
6f03d9e316
commit
b0bce075da
@@ -81,16 +81,16 @@ func (m *MessageProcessor) processCallMethod(method int, rw http.ResponseWriter,
|
||||
|
||||
ctx, cancel := context.WithCancel(context.WithoutCancel(r.Context()))
|
||||
|
||||
ambigiousID := false
|
||||
ambiguousID := false
|
||||
m.l.Lock()
|
||||
if m.runningCalls[*callID] != nil {
|
||||
ambigiousID = true
|
||||
ambiguousID = true
|
||||
} else {
|
||||
m.runningCalls[*callID] = cancel
|
||||
}
|
||||
m.l.Unlock()
|
||||
|
||||
if ambigiousID {
|
||||
if ambiguousID {
|
||||
cancel()
|
||||
m.callErrorCallback(window, "Error calling method: %s, a method call with the same id is already running", callID, err)
|
||||
return
|
||||
@@ -130,7 +130,12 @@ func (m *MessageProcessor) processCallMethod(method int, rw http.ResponseWriter,
|
||||
}
|
||||
}
|
||||
m.callCallback(window, callID, string(jsonResult), true)
|
||||
m.Info("Call Binding:", "method", boundMethod, "args", options.Args, "result", result)
|
||||
|
||||
var jsonArgs struct {
|
||||
Args json.RawMessage `json:"args"`
|
||||
}
|
||||
params.ToStruct(&jsonArgs)
|
||||
m.Info("Call Binding:", "method", boundMethod, "args", string(jsonArgs.Args), "result", result)
|
||||
}()
|
||||
m.ok(rw)
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user