0

This is easy to do for files added normally but for dynamically loaded JavaScript the debugger does not pull the files up.

For example,

I hit Cntl-Shift-J to bring up the debugger. I click the sources tab. I hit Cntl-O to bring up the files I can set break points on.

The only files listed are the ones I set using

<script></script>

But I also add JS files dynamically like this:

    if (file_type === 'js') {
        element = document.createElement('script');
        element.id = token;
        if (!source) {
            element.innerHTML = text;
            document.head.appendChild(element);
            if (callback) {
                callback();
            }
        } else {
            element.onload = callback;
            element.async = true;
            element.src = source;
            document.head.appendChild(element);
        }
        $A.Event.trigger(token);
        return;
    }

I don't have access to these files. How do I get it?

  • Looks like a [duplicate](http://stackoverflow.com/questions/1705952/is-possible-to-debug-dynamic-loading-javascript-by-some-debugger-like-webkit-fi) – m.casey Jul 09 '14 at 16:44
  • nevertheless, all you need to do is add in a comment in the file as such `//# sourceURL=dynamicScript.js` and it will appear with the other files. –  Jul 09 '14 at 16:50

1 Answers1

0

You can write the function:

debbuger();

This function will stop your code where you put it.

Also if you want a better experience I recomend using "Firebug" on Firefox, it is a great tool for web development!

https://addons.mozilla.org/es/firefox/addon/firebug/

Omarchh
  • 1
  • 2