Springer R8396

Member since: Friday, 18 September 2015
Last login: 4 years ago
Profile viewed: 1,030 views

No Rank
Points: 0

Springer R8396 created a new topic ' HTM/JavaScript best practices' in the forum. 6 years ago

I am using the TWebBrowser (VCL) and am passing it considerable javasceipt. I started with the JS as a constant but as it grew, I moved it to an HTM page module and call the JS from the header section.
Though I do appreciate the line numbers on the script errors, I benefit little from moving the code here, except that I can make some changes without recompiling.
I tried adding the JS to the a JavaScript module and having the HTML Page load it, but my external calls quite working - so I reverted back to everything on the HTM page.
My hope was to gain some editing help but I am not sure if I am using the page correctly.
Right now, my text turns red in the middle of a JS loop and all the subsequent text stays Red!
My JS checks out in Fiddle and Jet Brains so with so many externals, they are no longer viable editors.
What I am asking is some basic guidelines on this type of project that has over 800 lines of JS (Google Maps API) with desktop JS calls external calls.
This is my first project of this sort and I am approaching an hard to manage code base. Am I making the best use of Delphi for this?

procedure TfrmMain.FormCreate(Sender: TObject);


aStream: TFileStream;



if Assigned(WebBrowser1.Document) then


aStream := TFileStream.Create('myJavaScript.htm', fmOpenReadWrite or fmShareDenyNone);


(WebBrowser1.Document as IPersistStreamInit) .Load(TStreamAdapter.Create(aStream));




HTMLWindow2 := (WebBrowser1.Document as IHTMLDocument2).parentWindow;


fContainer := TExternalContainer.Create(WebBrowser1);



Springer R8396 replied to the topic 'Critical Section question' in the forum. 6 years ago

Yes, that will protect the processID as unique.