Disclosure Statement: This site contains affiliate links, which means that I may receive a commission if you make a purchase using these links. As an eBay Partner, I earn from qualifying purchases.
If you find these projects useful please consider becoming a sponsor with Patreon, GitHub or Liberapay.

How to execute JavaScript without interface UI

Post Reply
yiqianyishi
Posts: 18
Joined: Sun Jan 07, 2018 1:08 am

How to execute JavaScript without interface UI

Post by yiqianyishi »

Hi,
I want to do a service program, its function is to execute the JavaScript script and return the result. Because the service program does not have an UI interface, how can I directly call the kernel's JavaScript engine without loading the browser interface? If this can be done, can one or more external JavaScript files be executed by CEF4Delphi? Thank you.
User avatar
salvadordf
Posts: 4564
Joined: Thu Feb 02, 2017 12:24 pm
Location: Spain
Contact:

Re: How to execute JavaScript without interface UI

Post by salvadordf »

Hi,

I've never created a Windows service with Delphi but you might have a problem with the initialization and shutdown of the CEF libraries.

All CEF3 based applications can only be initialized and shutdown once per process.

In the case of CEF4Delphi, the initialization is done inside the GlobalCEFApp.StartMainProcess function and it is shutdown when you free GlobalCEFApp.

If you find a way to call GlobalCEFApp.StartMainProcess and GlobalCEFApp.Free only once, then the rest is easy. You would only have to use a TChromium in OSR mode for your JavaScript functions.
Post Reply