views:

28

answers:

0

Aptana is a useful debugging tool but one of the joys of liberally spreading aptana.log statements around in your javascript is that you have to remember to comment them out prior to running outside of the debug window.

Here is one trick that will allow you to continue sprinking debug statements around that will still work outside of debug mode and will allow your script to run in environments that don't have aptana installed.

If the aptana object doesn't exist then just create it with a dummy log, like so:

if (typeof aptana == "undefined") {
    var aptana = new Object();
    aptana.log = function(debug){
        //alert(debug); // uncomment if you want to see annoying popups
    }
}

Put that either in your init function or at the top of your script. If you want to see the debug statements serially then uncomment the alert, otherwise your script will now happily run. You can also extend this by adding in any other aptana debugging functions you're using, etc.