Subj : New to Javascript questions
To   : Vonskie
From : echicken
Date : Sun Aug 11 2019 03:03 am

 Re: New to Javascript questions
 By: Vonskie to ALL on Sat Aug 10 2019 21:53:35

Vo> How would you debug an index.xjs file

I would look at the error message(s) being generated and then address them by fixing the embedded SSJS.
Or if there are no errors, I'd examine the script(s) until I found the cause of whatever bug I was trying
to find.

Vo> I have vscode for linux loaded it does not know what that file type is

XJS is unique to Synchronet.  It's HTML with embedded server-side javascript.  VS Code wouldn't know what
it was unless someone wrote a plug-in / extension to handle it, and I'm 99.99999% certain that hasn't
been done.  I almost started on one a month or two ago but it seemed like a lot of hassle for something I
haven't needed thus far.

Vo> I know you can use notepad mousepad etc to edit the file and the load the
Vo> webpage but there must be a better way?

"There must be a better way" is a big assumption.  There are a lot of things about the nature of
Synchronet that make such assumptions unsafe.  We can dig into that further if you really want to know
more.

Vo> So you can step thru code and watch variables etc.

As far as I know, we don't have a debug tool for JS available that'll do what you're describing.  (I
think jsexec has a step debugger, but that won't help you with the webserver.)

Normally if I can't figure something out just by reading the relevant scripts and error messages, I start
inserting log() or write() statements in relevant places so I can examine the state of things at various
stages.  It's ugly, but it works.

---
echicken
electronic chicken bbs - bbs.electronicchicken.com
� Synchronet � electronic chicken bbs - bbs.electronicchicken.com