-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request - Async Javascript Binding Add support for returning Task #2758
Comments
There are no examples as it's not currently support, the name is slightly misleading in this instance. Only the JavaScript side of the equation is actually asynchronous. It's difficult to implement this feature, you are welcome to submit a pull request. The current supported method of executing long running tasks is to use a callback see https://github.com/cefsharp/CefSharp/blob/cefsharp/73/CefSharp.Example/JavascriptBinding/BoundObject.cs#L58 |
Had a quick look and it occurred to me that the A very rough implementation is at amaitland@a9f20ac No where near production ready. |
Right, I thought it was supported, and I did something wrong. However, it's odd that everything locks up when an |
Support has been added in #2771 There are some You need to set the follow before creating your THIS FEATURE IS ONLY AVAILABLE WHEN REGISTERING AN OBJECT AS ASYNC e.g. CefSharpSettings.ConcurrentTaskExecution = true; Examplepublic async Task<string[]> AsyncDownloadFileAndSplitOnNewLines(string url)
{
var webClient = new WebClient();
var download = await webClient.DownloadStringTaskAsync(new Uri(url));
var lines = download.Split('\n').Where(x => !string.IsNullOrEmpty(x.Trim())).ToArray();
return lines;
} const url = "https://raw.githubusercontent.com/cefsharp/CefSharp/master/.editorconfig";
boundAsync.asyncDownloadFileAndSplitOnNewLines(url).then(function (lines)
{
//Do something with the result.
}); |
What version of the product are you using?
73.1.130
What architecture x86 or x64?
System architecture - x64, problem exists on both program architectures
On what operating system?
Win10
Are you using
WinForms
,WPF
orOffScreen
?WPF
What steps will reproduce the problem?
Bind a simple object, which has an
async
method. Run the method from Javascript.https://gist.github.com/perf2711/e96e69abad24c254d0192e88eb705709
I hosted the
index.html
file throughpython3 -m http.server 8000
.What is the expected output? What do you see instead?
Synchronous methods work as they should, as well waiting for result from an asynchronous method in synchronous context. When running an
async
method, nothing is returned, promise never resolves and the object "locks up", preventing any additional calls.This code was run inside the developer console.
Please provide any additional information below.
No exceptions are thrown. Breakpoints in each function are triggered.
I don't see any information regarding not using
async
methods in bound objects inGeneral usage
, however, there are no examples of such case.Does this problem also occur in the
CEF
Sample Application from http://opensource.spotify.com/cefbuilds/index.html?No, at least not in the
Javascript Binding
test. Anyway I think this issue cannot be reproduced in the sample app.The text was updated successfully, but these errors were encountered: