insert .js line to show line was executed

Started by Recursos, November 02, 2020, 01:12:32 PM

Previous topic - Next topic

Recursos

(SMF2.1 RC3 running in free hosting server)
Newbie here.

Would like to edit js file
(like:
htdocs/Themes/default/scripts/theme.js
)
adding a line that somehow shows that the line itself was executed
(perhaps logging a error if that is feasible)
Thanks,
Rec

Arantor

What are you actually trying to do? It sounds to me you really want to set a breakpoint in your browser.

Recursos

Something like that, or not even a breakpoint, just some way to know that the code effectively run and executed that line.
To log some error would do.
Installed SMF2.1 RC3 in a free hosting server, with FileManager I can edit and save files.
Need to check if the file is being executed at all.
Rec

Arantor

Yes but why? A breakpoint would absolutely tell you that without even changing the file, but what are you actually hoping to prove with it?

Recursos

I want to check if the file.js is being executed at all.
Is it possible to set a breakpoint in the free hosting server?
Rec

Arantor

#5
That doesn't answer my question.

When you set a breakpoint in your browser (no file editing, it's done in the UI in your browser when the browser gets to a certain point), you presumably are waiting to see if a certain thing happens in the file.

What are you looking to prove? The file merely being executed does almost nothing on its own. Therefore you want to prove something specific, what?


EDIT: I'm not doing this to be awkward, it's just that verifying the file loads (which is what you're currently asking for) versus it doing something is a very complex proposition - you haven't even said what line it is you want to test for having run, which may not do what you think it will, doubly so if you're using SMF 2.1 and you're using minified files (which is another reason why it matters what you're actually trying to do)

Recursos

@Arantor

Just the word "minified" helped a lot, I wasn't aware of that!
QuoteTherefore you want to prove something specific, what?
I wanted to know if the file.js was executed (if the path for calling it was right) or just sitting idle.
I still don't get how to set a BP in the browser, as I think the page is dynamically built and served remotely.
In the end I got something that worked - echoing a string to a little real state on the page.

Thanks for your help. My ignorance is vast!
Rec

Arantor

Not being funny but your ignorance is going to *remain* vast if you can't ever say what you're hoping to achieve and fixate only on how you think you have to get there. Especially when you had one of the former developers of SMF trying to help you understand SMF.

So what? You now know a given file is executed. Congratulations, what did you learn from it?

Recursos

#8
@Arantor
Thanks for your help.
Who is the "former developers of SMF"?
Rec

About darkness and ignorance:

Arantor

Me. I wrote parts of SMF. I also debug and develop software literally every day at work, so I know a fair amount about diagnosing all kinds of problems.

My point is, by "proving a file is running" is useful in some specific cases if you have suspicions about it not running but you didn't indicate that was your problem.

To use your metaphor, you already had the light switch, you were just asking "is the switch connected to anything" without asserting why this was relevant or what you hoped to do with this new found knowledge.


Recursos

Me. I wrote parts of SMF.
I respect that.
Rec

Advertisement: