Welcome Guest Search | Active Topics | Sign In | Register

Async/Await or Promises with C#/JS bridge? Options
James
Posted: Wednesday, September 23, 2020 11:32:37 AM
Rank: Advanced Member
Groups: Member

Joined: 2/11/2015
Posts: 122
Due to the changes which prevents re-entrant situations I was hoping I could setup my JS/C# bridge code to be awaitable or use promises in order to allow web developers to get a reliable interface for avoiding race conditions.

I wanted to know if there was anything that was already provided by EO to facilitate this or if there are reasons I'm unaware of that I can't accomplish this goal.

I know that the new WebView2 project by microsoft is working to provide such a feature and was hoping we may have something here.
eo_support
Posted: Wednesday, September 23, 2020 4:11:26 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

You can do it in asynchronously fashion based on this method:

https://www.essentialobjects.com/doc/eo.base.waitabletask.ondone_overloads.aspx

The code will be something like this:

Code: C#
webView.QueueScriptCall(jsCode).OnDone(()=>
{
  //code to be called when done
});


We do not have any plan to support async/await version in the near future because our library needs to maintain backwards compatible with .NET 2.0. In order to support async/await we must remove .NET 2.0 support first.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.