Server-side JavaScript

Welcome

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

Support Options

1. Search this site.
2. Make or vote for a Suggestion.
3. Post to Community Support.
3. Contact EditMe Support staff.

Stay Informed

Keep informed of product changes, tutorials and tips via EditMe's Blog and monthly newsletter.

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.