|
Sydney | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Object | +--Debug
Defined in debug.js
Constructor Summary | |
Debug
()
|
Method Summary | |
void
|
assert(cond, varArgs)
Asserts that cond is true .
|
void
|
clear()
Empties the console of any child nodes--effectively clearing it. |
void
|
dumpArray(arr)
Prints an array to the debug console in a nice way. |
void
|
dumpObject(obj)
Prints an object to the console in object-literal syntax. |
void
|
print(varArgs)
Prepends str to the console.
|
Object
|
setConsole(element)
Initializes the console to element .
|
void
|
setTrace(<boolean> newTracing)
Turns tracing on or off. |
void
|
traceIn(funcName, args)
Prints --> funcName([args[0][, args[1][, ...]]]) to the console. |
Object
|
traceOut(retVal)
Pops a function name off the tracing stack and prints it. |
Constructor Detail |
function Debug()
Method Detail |
void assert(cond, varArgs)
cond
is true
. assert
returns immediately
if cond
is true
. If cond
is false
,
then assert
sends str
to the console, prepended by 'ERROR: '
,
styled as red, bold text on a white background, and then throws str
as an exception.
cond
- a boolean
which must be true
, or assert
will throw an exception
str
- a string
to display (and throw) if cond
is false
.
void clear()
WARNING: if the console contains child nodes not related to debug output, this function will delete them, too.
void dumpArray(arr)
arr
- the array to print
void dumpObject(obj)
obj
- the object to print out
void print(varArgs)
str
to the console.
str
- the string
to prepend to the console
Object setConsole(element)
element
.
Returns the old console, or null
if there wasn't one.
void setTrace(<boolean> newTracing)
tracing
is true
and the debug
console is non-null then calls to traceIn
and traceOut
will
produce output.
newTracing
- after this function returns, traceIn
and traceOut
will produce output only if newTracing
is true
.
void traceIn(funcName, args)
funcName
- the name of the function being traced into
args
- the array of arguments passed to the traced function. Typically the predefined arguments
array is passed for args
.
Object traceOut(retVal)
retVal
is defined,
then the function name is followed by a string version of retVal
. retVal
is returned, even if tracing is turned off. This means you can say return Debug.traceOut(ret);
even if tracing is turned off.
retVal
- the value to return
retVal
is always returned
|
Sydney | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |