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?
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
.https://github.com/wailsapp/go-webview2/blob/1cea6fa283522b953f44435a08c88da6ff35988b/pkg/webview2/ICoreWebView2AddScriptToExecuteOnDocumentCreatedCompletedHandler.go#L36-L43
In conclusion, I would like to know if there is any way to pass a callback function when calling
ExecuteScript
.