Page 1 of 1
Capture JavaScript function return
Posted: Sat May 19, 2018 9:25 pm
by EdsonAlves
Is it possible to execute an asynchronous javascript function and play the return on a promisse and how much does the resolver function capture its return in delphi?
Re: Capture JavaScript function return
Posted: Sun May 20, 2018 7:14 am
by salvadordf
Hi,
You can execute customized JavaScript code using TChromium.ExecuteJavaScript. That code can call any kind of JavaScript functions, including registered extensions.
Those extensions are Delphi functions but they are executed in the render process so you will have to send the results to the main browser process using TCefv8ContextRef.Current.Browser.SendProcessMessage. That message is received in the TChromium.OnProcessMessageReceived event.
All this is explained in the code comments added to the JSRTTIExtension and JSExtension demos.