Recently, I wrote a simple AJAX debugger which can be useful in the debugging of complex types such as Objects, Arrays, JSON etc.
The AJAX Debugger traces out all inherited and “own” properties of user defined Object instances, properties/values of an Object, indexes of an Array, etc. – to a div
with an id
of “console” within an application.
To use the AJAX Debugger, simply include debugger.js in your application during development and create a div
on the page with an id
of “console” to serve as an output panel (I plan to implement the creation of the console div
automatically in the next release).
To log output to the console, use the debugger’s trace
function:
1 2 3 4 5 6 | // whereas the first param is an object of any type to trace // and the second param instructs the debugger to recursively // trace out the object or not. trace (object, true); |
1 2 3 4 5 6 7 8 9 10 11 | trace({ 'name': 'AJAX Debugger', 'build': 1.0 }, true); // Outputs the following to the "console" div: // Found instance of type : Object // .name = AJAX Debugger // .build = 1 |
An upgrade to version 1.0 will be made within the next few weeks, allowing for the ability to launch the console in a separate window independent of the application itself.
An example of can be found
here
The AJAX Debugger can be downloaded
here.
Feel free to email me with your thoughts and / or ideas to make the Debugger better.