API | Debug

These commands control the contents and visibility of the debug window.

 

PS.debug ( text )

PS.debug() appends text to the debug window, and opens the window if it is closed.

Parameters:

  1. (optional) text : string

Returns: PS.DONE or PS.ERROR

The string specified in the optional text parameter is appended to the text already in the debugger window (if any).

If you want your debugger output to terminate with a newline ("\n"), you must include one at the end of the text string.

If text is the empty string ("") or not supplied, the debugger window is opened without appending anything.

If text is not a string, the supplied parameter is converted to a string and displayed.

Return value

PS.debug() returns PS.DONE if it succeeds, else PS.ERROR.

// EXAMPLE:
// Display coordinates of a clicked/touched bead
// Newline ("\n") at end of string isolates output

PS.touch = function( x, y, data, options ) {
 PS.debug( "X = " + x + ", Y = " + y + "\n" );
};

 

PS.debugClear ( )

PS.debugClear() removes all text from the debugger window.

Parameters: none

Returns: PS.DONE or PS.ERROR

PS.debugClear() only clears the debugger window. If you want to close it, call PS.debugClose().

Return value

PS.debug() returns PS.DONE if it succeeds, else PS.ERROR.

 

PS.debugClose ( )

PS.debugClose() closes the debug window.

Parameters: none

Returns: PS.DONE or PS.ERROR

PS.debugClose() does not change the contents of the debug window. If the window is reopened by a subsequent call to PS.debug(), any previous contents will still be visible.

Return value

PS.debugClose() returns PS.DONE if it succeeds, else PS.ERROR.