Skip to content

frinknet/DBG.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 

Repository files navigation

DBG.js

DBG.js Debugging Keywords for JavaScript

see DBG.html for demo

EXAMPLE USAGE

// logs the line and the function scope at this line
DBG;

// logs an alternate message instead of the function scope
DBG = 'alternate message';

// logs an array instead of a message
DBG = ['report', 'this is the way it is'];

// Log a breakpoint entry
BRK = "breakpoint";

// Log the current time
NOW;

// demonstraites a simple function logging the line number and scope
function wait5sec() {
    var start = (new Date()).getTime();
    while ((new Date()).getTime() - start < 5000);
    DBG = "waiting";
}

// demonstraites the TIME keyword which creates a timestamp for the last time that line was accessed
(function(){
	// timer
	NOW;
	wait5sec();
	NOW;
})();

//output a DBG report.
DBGReport = DBG;

Getting the DBG object always returns the array of DBG logs. You can look at the DBG object using either Firebug, Webkit Instpector or Internet Explorer Debeloper Tools.

About

DBG Debug Keywords for JavaScript

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published