mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-19 10:29:29 +08:00
[v3 windows] Handle null result from callbacks. Call results should respond on main thread.
This commit is contained in:
parent
7c45e3ac13
commit
81a5380f67
@ -49,11 +49,14 @@ func (m *MessageProcessor) processCallMethod(method string, rw http.ResponseWrit
|
|||||||
m.callErrorCallback(window, "Error calling method: %s", callID, err)
|
m.callErrorCallback(window, "Error calling method: %s", callID, err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// convert result to json
|
var jsonResult = []byte("{}")
|
||||||
jsonResult, err := json.Marshal(result)
|
if result != nil {
|
||||||
if err != nil {
|
// convert result to json
|
||||||
m.callErrorCallback(window, "Error converting result to json: %s", callID, err)
|
jsonResult, err = json.Marshal(result)
|
||||||
return
|
if err != nil {
|
||||||
|
m.callErrorCallback(window, "Error converting result to json: %s", callID, err)
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
m.callCallback(window, callID, string(jsonResult), true)
|
m.callCallback(window, callID, string(jsonResult), true)
|
||||||
}()
|
}()
|
||||||
|
@ -90,7 +90,9 @@ func (w *windowsWebviewWindow) setMaxSize(width, height int) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *windowsWebviewWindow) execJS(js string) {
|
func (w *windowsWebviewWindow) execJS(js string) {
|
||||||
w.chromium.Eval(js)
|
invokeSync(func() {
|
||||||
|
w.chromium.Eval(js)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *windowsWebviewWindow) setBackgroundColour(color RGBA) {
|
func (w *windowsWebviewWindow) setBackgroundColour(color RGBA) {
|
||||||
|
Loading…
Reference in New Issue
Block a user