Adobe 12040118 Using Help - Page 18
Script Breakpoints window, The $ object
UPC - 718659361808
View all Adobe 12040118 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 18 highlights
Help Using Help JavaScript Debugging Back 18 box.width = 48; box.height = 48; box.url = "none"; } To execute a breakpoint in runtime code, call the $.bp() method, as shown in the following example: function setupBox(box) { box.width = (box.width == undefined) ? $.bp() : 48; box.height = (box.height == undefined) ? $.bp() : 48; box.url = (box.url == undefined) ? $.bp() : "none"; } This example breaks into the JavaScript Debugger if any of the width, height, or url attributes of the custom element are undefined. Of course, you wouldn't put bp method calls into production code-it's more appropriate for shipping code to set default values for undefined properties, as the previous example does. Script Breakpoints window Display of the Script Breakpoints window is controlled by the Script Breakpoints button in the JavaScript Debugger. This window displays all defined breakpoints. This window does not display temporary breakpoints or breakpoints defined by the debugger statement in JavaScript code. The Script Breakpoints window provides the following controls: • The Line field contains the line number of the breakpoint. • The Condition field may contain a JavaScript expression to evaluate when the breakpoint is reached. If the expression evaluates to false, the breakpoint is not executed. • Breakpoints set in this window persist across multiple executions of a script. When the application quits or a script is reloaded, it removes all breakpoints. To set a breakpoint in the Script Breakpoints window: 1 Click New to create a new breakpoint, or click the breakpoint that you wish to edit. 2 Enter a line number in the Line Number field, or change the existing line number. 3 Optionally, enter a condition such as (i>5) in the Condition field. This can be any valid JavaScript expression. If the result of evaluating the expression is true, the breakpoint activates. The $ object The $ object (Debugger Object) provides properties and methods you can use to debug your JavaScript code. For example, you can call its methods to set or clear breakpoints programmatically, or to change the language flavor of the script currently executing. It also provides properties that hold information about the version of the host platform's operating system. Note: The $ object is not a standard JavaScript object. Properties Name error Type Error Description Retrieve the last runtime error. Reading this property returns an Error object containing information about the last runtime error. Using Help Back 18