MicrosoftEdge / MicrosoftEdge/WebView2Feedback
WebView2 corespondent for CefSharp IJavascriptCallback
Open
@david-risney is already working on this.
Since Jul 28, 2022.
bug
tracked
- Dominant language
- PowerShell
- Stars
- 526
- Forks
- 67
- PR merge metrics
- No merged PRs in 30d
Description
I am using Microsoft.Web.WebView2 version 1.0.1185.39.
I have an object in C# that I use AddHostObjectToScript("MyObject", new MyObject()); to add it to the browser.
This was one of the methods from MyObject.cs in C#
public string ExecuteTask(bool full, IJavascriptCallback callback= null)
{
Task.Run(() =>
{
( ... do stuff ...)
callback.ExecuteAsync(result);
});
return "";
}
===================================
And this was the javascript code:
var objectCS = window["MyObject"];
return new Promise((resolve) => {
objectCS .ExecuteTask(full, (response) => {
var responseParsed = JSON.parse(response);
resolve(responseParsed );
});
});
===================================
My problem is that I do not know for WebView2, what value should the callback parameter from C# have.
Any idea is very much appreciated
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.