2

I can successfully raise an event from JS into my delphi application using the technique described in this link:

Delphi Chromium Embedded - communication between Javascript and application code

Now I want to return a value from a function that called in JS.

I test this case: I raise an event in the function that assign a variable in delphi. This method is asynchronous, which means when I call ExecuteJavaScript, the function immediately returns (unblocking) and before the variable is assigned with JS, I reach the variable that is not assigned.

I try to use a sleep(100) function after ExecuteJavaScript and this works well but it is not a very nice solution.

Is there any way to have returns from functions, without using events?

Community
  • 1
  • 1
Moharram
  • 21
  • 3
  • You can [`ExecuteFunction`](http://magpcss.org/ceforum/apidocs3/projects/%28default%29/CefV8Value.html#ExecuteFunction). That little beast is synchronous within the context and returns what the JS function does (and no, I don't have an example, because I'm not using DCEF3). – TLama May 06 '15 at 11:11
  • function ExecuteFunction does'nt exist! – Moharram May 07 '15 at 04:59
  • Oh yes, yes, it does (you would find this out by a simple search in the source). It is the `ICefv8Value` interface method and you can implement [`something like this`](https://bitbucket.org/chromiumembedded/cef/wiki/JavaScriptIntegration#markdown-header-executing-functions). Just in Delphi. – TLama May 07 '15 at 09:30

0 Answers0