[v3] Fix bindings

This commit is contained in:
Lea Anthony
2023-08-27 15:54:01 +10:00
parent 2f9f63771b
commit cdf48e0589
25 changed files with 1106 additions and 357 deletions
+14 -9
View File
@@ -39,18 +39,23 @@ func (m *MessageProcessor) processCallMethod(method string, rw http.ResponseWrit
return
}
var boundMethod *BoundMethod
id, err := strconv.ParseUint(r.Header.Get("x-wails-method-id"), 10, 32)
if err != nil {
m.callErrorCallback(window, "Error parsing method id for call: %s", callID, err)
return
}
if id != 0 {
boundMethod = globalApplication.bindings.GetByID(uint32(id))
} else {
methodID := r.Header.Get("x-wails-method-id")
if methodID == "" {
boundMethod = globalApplication.bindings.Get(&options)
if boundMethod == nil {
m.callErrorCallback(window, "Error getting binding for method: %s", callID, fmt.Errorf("method '%s' not found", options.Name()))
return
}
} else {
id, err := strconv.ParseUint(methodID, 10, 32)
if err != nil {
m.callErrorCallback(window, "Error parsing method id for call: %s", callID, err)
return
}
boundMethod = globalApplication.bindings.GetByID(uint32(id))
}
if boundMethod == nil {
m.callErrorCallback(window, "Error getting binding for method: %s", callID, fmt.Errorf("'%s' not found", options.MethodName))
m.callErrorCallback(window, "Error getting binding for method: %s", callID, fmt.Errorf("method ID '%s' not found", options.Name()))
return
}
go func() {