using promises with cef

Do not post support requests, bug reports or feature requests. Discuss CEF here. Non-CEF related discussion goes in General Discussion!

using promises with cef

Postby giridharb54 » Mon Jan 13, 2014 2:53 pm

Hi all,

I went through the concept of promises and was thrilled by it. We are planning to use it in our application. I didnt understand few things If i make a call as below.
Code: Select all
app.ready().then (function(args){},function(errors){});


How to handle this call in the renderprocess v8handler execute function?? Will the function inside then be a part of arguments in the execute function on the native side??
giridharb54
Expert
 
Posts: 100
Joined: Thu Oct 17, 2013 2:15 am

Re: using promises with cef

Postby magreenblatt » Mon Jan 13, 2014 3:47 pm

You'll need some JavaScript library that implements the promises framework. At the lowest level it will boil down to a call that looks like this:
Code: Select all
window.myfunc([success,failure]);

You then implement `myfunc` using native bindings and save a reference to the CefV8Value for the success and failure functions. Once a response is received from the browser process you execute the associated function asynchronously. A version of this approach is demonstrated by https://code.google.com/p/chromiumembed ... s_Bindings.
magreenblatt
Site Admin
 
Posts: 12409
Joined: Fri May 29, 2009 6:57 pm


Return to CEF Discussion

Who is online

Users browsing this forum: No registered users and 142 guests