Server-side JavaScript

Search:

Welcome

Login to contribute. Register if you haven't yet.

Need Support?

Search this site to find an answer. If you still need help, post a Question. Private or account-related support inquiries can be made at the Private Support forum.

Server Side JavaScript Debugging

Return to Developer Support

EditMe's JavaScript API includes a few simple tools to simplify debugging. The util implicit object contains the following:

util.debugMode = true | false;  <=  set the debug mode on or off.

util.debug('Something happened!');  <=  add a debug message

util.debugMessages   <= spits out the debug messages in a <pre> tag.

Using the above, you can include debug messages throughout your page and toggle whether they are collected/displayed or not with a single true/false at the top. Consider the following example:

<div>
<script type="text/vnd.editme.js">
util.debugMode = true;  // <= set to false to turn off debugging
// do a bunch of stuff
util.debug('Print this debug message.');
// do more stuff.
</script>
<span editme="cdata util.debugMessages"></span>
<!-- rest of page content goes here -->
<div> 

Using this pattern, you can leave debug messages in your code and easily toggle their display on or off.