namespace SAPO.Utility.Debug
Implements a debug console if browser doesn't have it, otherwise falls back to console.log.
 requires SAPO.Dom.Event
 
Authors:
jose.p.dias AT co.sapo.pt
Version:
0.1
Since:
February 2011

Function Summary
DomElement addPoint (DomElement parentEl, Number[] pos, [String color], [Number side])
creates an absolute positioned element, useful for debugging offsets and mouse positions
DomElement addRect (DomElement parentEl, Number[] pos, Number[] dims, [String color])
creates an absolute positioned element, useful for debugging offsets, mouse positions and dimensions
sets start of timing
Number chronoStop (String name, [Boolean lapMode])
returns time elapsed between this call and last chronoStart or chronoStop for the same name, in ms
log (String msg)
displays content in console
String|DomElement movePoint (Number[] pos)
to update a point's location
removePoints (DomElement parentEl)
removes all previously created points in parentEl
removeRects (DomElement parentEl)
removes all previously created rects in parentEl
String|DomElement updateRect ([Number[] pos], [Number[] dims])
to update rect's position and/or dimensions

Function Details

function addPoint

DomElement addPoint(DomElement parentEl, Number[] pos, [String color], [Number side])
creates an absolute positioned element, useful for debugging offsets and mouse positions
Parameters:
parentEl - parent element
pos - x, y pair of integer coordinates
[color] - default is magenta ('#F0F')
[side] - default is 3

function addRect

DomElement addRect(DomElement parentEl, Number[] pos, Number[] dims, [String color])
creates an absolute positioned element, useful for debugging offsets, mouse positions and dimensions
Parameters:
parentEl - parent element
pos - x, y pair of integer coordinates
dims - w, h pair of integer dimensions
[color] - default is magenta ('#F0F')

function chronoStart

chronoStart(String name)
sets start of timing
Parameters:
name - identifier for the time being measured (defaults to '_default_')

function chronoStop

Number chronoStop(String name, [Boolean lapMode])
returns time elapsed between this call and last chronoStart or chronoStop for the same name, in ms
Parameters:
name - identifier for the time being measured (defaults to '_default_')
[lapMode] - if true, doesn't update measure internally

function log

log(String msg)
displays content in console
Parameters:
msg content to append to the console

function movePoint

String|DomElement movePoint(Number[] pos)
to update a point's location
Parameters:
pos - x, y pair of integer coordinates

function removePoints

removePoints(DomElement parentEl)
removes all previously created points in parentEl
Parameters:
parentEl - parent element

function removeRects

removeRects(DomElement parentEl)
removes all previously created rects in parentEl
Parameters:
parentEl - parent element

function updateRect

String|DomElement updateRect([Number[] pos], [Number[] dims])
to update rect's position and/or dimensions
Parameters:
[pos] - x, y pair of integer coordinates
[dims] - w, h pair of integer dimensions