I\'d like to embed the V8 JavaScript interpreter that ships with Google Chrome within my Delphi application. I\'m aware of the chromium embedded open-source project from Goo
Start from Jun 1, 2016, we have v8delphiwrapper, kudos to the developer @zolagiggszhou. And I'd like to show you some code example:
string
:Memo2.Text := FEngine.eval(Memo1.Text);
1 - Assuming you have a Delphi class like this:
TJsAccessableClass = class
public
function add(a,b: Double): Double;
function httpEncode(const s: string): string;
end;
2 - You register it with the v8 js engine:
FObjectTemplate2 := FEngine.RegisterRttiClass(TJsAccessableClass);
FJsAccessableObject := FObjectTemplate2.CreateInstance(TJsAccessableClass.Create);
Fv8GlobalObject.SetObject('delphiObj', FJsAccessableObject);
3 - Now you can call your Delphi method from js:
var s = delphiObj.httpEncode('/~!f234');
Very cool! More example please check v8delphiwrapper sample project