You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way to pass a callback function when calling ExecuteScript?
For example, consider the following code snippet.
This code, of course, will panic during runtime.
Could you please provide the correct way to do this?
callback:=func(errorCodeuintptr, resultObjectAsJsonstring) {
// print error and result
}
_, _, err=e.webview.vtbl.ExecuteScript.Call(
uintptr(unsafe.Pointer(e.webview)),
uintptr(unsafe.Pointer(_script)),
uintptr(unsafe.Pointer(&callback)),
)
The reason seems to be the id parameter of the function in the following code is of type string, and the error disappeared after I replaced it with uintptr, however, the similar situation is common in go-webview2.
Is there any way to pass a callback function when calling
ExecuteScript
?For example, consider the following code snippet.
This code, of course, will panic during runtime.
Could you please provide the correct way to do this?
In C++, similar code looks like this:
However, I found that
go-webview2
cannot even createICoreWebView2ExecuteScriptCompletedHandler
.Here's the complete code:
panic massage:
The reason seems to be the
id
parameter of the function in the following code is of typestring
, and the error disappeared after I replaced it withuintptr
, however, the similar situation is common ingo-webview2
.go-webview2/pkg/webview2/ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler.go
Lines 36 to 43 in 1cea6fa
In conclusion, I would like to know if there is any way to pass a callback function when calling
ExecuteScript
.The text was updated successfully, but these errors were encountered: