Reputation: 43843
In a javascript file, I have a jquery function that loads a javascript file using getScript
. The problem is when I want to debug the downloaded script, it is not easy to find it in debugger tools. It looks like this:
Where it says eval code, thats the downloaded script. Is there a way I can put a name on that? Like for example in the script thats being downloaded, I want something like
namespace("control.js");
Then in the debugger tools, instead of 'eval code' it will say 'control.js'.
Does anyone know a way for this?
Thanks
Upvotes: 0
Views: 680
Reputation: 295
A bit of a late response, but this might be useful for other people still;
//# sourceURL=url
The above can be added to the end of an eval string, to indicate its source. I am not sure if it would show up properly in those debugger tools. But it does at least show up properly when it is logging data in chrome.
source: https://www.html5rocks.com/en/tutorials/developertools/sourcemaps/#toc-sourceurl
Upvotes: 2
Reputation: 1
At chromium / chrome , should be able to open console
-> select Sources
tab, select resource from left panel -> copy source of resource -> at left panel select Snippets
-> right click in Snippets
panel , select New
-> name snippet when *Script snippet #n
highlighted in left panel -> paste source of selected resource into middle panel -> select all pasted source of resouce -> right click while source highlighted -> select Add to Watch
-> at right panel selected snippet should be listed at Watch Expressions
Upvotes: 0