Class Debug

Provides debugging and tracing functionality for client ECMAScript (JavaScript) code. This class is static and can be invoked directly without creating an instance of the class.

see

{@link http://msdn.microsoft.com/en-us/library/bb397422(v=vs.100).aspx}

Index

Constructor methods

Methods

Constructor methods

constructor(): Debug

Initializes a new instance of the Sys.Debug class.

Returns

Debug

Methods

public static assert(condition: boolean, message?: string, displayCaller?: boolean)

Checks for a condition, and if the condition is false, displays a message and prompts the user to break into the debugger. When you call the assert method in your code, express the success of an operation as true or false and use that value for condition. If the operation fails (if condition is false), the assert logic is executed. The assert method should be used to catch developer errors. To respond to user errors and to run-time error conditions such as network errors or permission failures, throw an exception. Debugging behavior, requirements, and the output of trace messages vary with different browsers. For more information, see Debugging and Tracing Ajax Applications Overview.

Parameters

  • condition: boolean
     true to continue to execute code; false to display message and break into the debugger.
    
  • message?: string optional
     (Optional) The message to display. The default is an empty string ("").
    
  • displayCaller?: boolean optional
     (Optional) true to indicate that the name of the function that is calling assert should be displayed in the message. The default is false.
    

public static clearTrace()

Clears all trace messages from the trace console.

public static fail(message: string)

Displays a message in the debugger's output window and breaks into the debugger.

Parameters

  • message: string
          The message to display.
    

public static trace(text: string)

Appends a text line to the debugger console and to the trace console, if available.

Parameters

  • text: string
      The text to display.
    

public static traceDump(object: any, name?: string)

Dumps an object to the debugger console and to the trace console, if available.

Parameters

  • object: any
     The object to dump.
    
  • name?: string optional
     (Optional) The name of the object.