JS version key Wizard-elf dot simple tutorial 4--Edit and Debug script

Source: Internet
Author: User

absrtact: If you follow the instructions in the previous step, you should have entered the " editing interface " more than once. But there is no real handwritten line of script. Now let's write our first point-of-order script, Hello Jianjian.

To write a script, you first have to go to the " Edit Interface ", where we click on the " new " button from the " main screen " to enter. After entering, in the edit box, enter the following code

Catalogue

Elf Point Point Simple Tutorial 1--Download and install

Elf Dot Simple tutorial 2--Basic operation

Elf Dot Simple Tutorial 3--recording script

Elf Dot Simple Tutorial 4--editing and debugging scripts

Elf Dot Simple Tutorial 5--writing extensions

First point-point script: Hello Jianjian

If you follow the instructions in the previous step, you should have entered the " editing interface " more than once. But there is no real handwritten line of script. Now let's write our first point-of-order script, Hello Jianjian.

To write a script, you first have to go to the " Edit Interface ", where we click on the " new " button from the " main screen " to enter. After entering, in the edit box, enter the following code

Alert (' Hello Jianjian ');

Then click Debug to see what the effect is? is not a popup with a hint text for "Hello Jianjian" dialog box.

is not a little bit excited, finally by hand hit the code to run out the effect, of course, this is too simple, below we come to a complex point.

var a = 1; if (a==1) {alert (' Hello Jianjian ');}  else{for (Var i=0;i<2;i++) {debug (' AA ');  } var II = 0;    while (ii<2) {info (' BB ');  ii++; }}

is not a bit familiar, yes this is the JS syntax, as long as you are familiar with JS syntax, write point script is almost zero learning cost, only need to remember some points of the built-in function can be

Point-and-click supported functions refer to " Point API Quick Check " and "Point-and-click API Quick Check "

JS syntax, you can refer to the online tutorial, a lot, here is not detailed introduction.

Editing and debugging Scripts

Click " New " in the main interface " operating area ".

In the main interface " script list and operation area " Click on the " Edit script " button

Click on " record " in the main interface " operating area " to enter " script editing and debugging Interface " When recording is aborted.

The interface is as follows:

Editing feature directory support Less, mainly is the syntax coloring, automatic indentation function, for the time being not described in detail.

The following is a detailed debugging function, the use of debugging features and other Ides are basically the same.

First break points where needed, the way to break points is to click on the left gray area of the editing area, after hitting the breakpoint, the interface is as follows.

Then click the Debug button. After the program runs, it will break on the third line, when the interface below is interrupted.

At this point you can enter "a" at the command, and then enter. Then enter "D" and then enter. The interface looks like this:

As you can see, the value of "a" has been output to "1". The value of "D" is "undefined". This is because. The third line is currently interrupted, and only three lines of code are executed. So the value of "a" comes out, but the value of "D" does not come out.

At this time

    • If you want to step into the debugging (encountered function into the body of the function), you can click the "Step Into" button. Shortcut key "F7"
    • If you want to step through the debugging (if you encounter a function skip directly) then click the "Step" button Shortcut "F8"
    • If you want to jump directly to the next breakpoint, click the Continue button.
    • If you want to abort debugging, then click the Stop button directly.

If you want to " cancel the breakpoint " directly at the red dot a little bit more.

Of course, some of the scene breakpoint debugging is not very convenient, so we also encapsulated some debugging functions.

respectively is

Debug (msg); info (msg); Warning (msg); error (msg); fatal (MSG);
For example, enter the following code
Debug (' This is Debug message '), info (' This is Info message '), warn (' This is warn message '), error (' This is error message '); FA Tal (' This is fatal message ');

The results of the implementation are as follows:


The default debug level is "info", so only the levels above "info" are displayed, and the "debug" level is not displayed. If you want to display the "DEBUG" level of information, just precede the above code with a sentence

Setdebuglevel (DEBUG);

Can.

    • Debug: Debug script applied to this level
    • INFO: Record The daily operation of the script applied to this level
    • WARN: Indicates the existence of a potential error in the script apply this level
    • Error: Although errors occur, but do not affect the script to apply to this level of normal operation
    • FATAL: A fatal error has occurred and the script should not continue to execute

Debug Information in the edit page (Debug interface)will output the appropriate information to the command-line window based on the level. In " Run mode " (Click Run on Main interface) is currently ignored directly

JS version key Wizard-elf dot simple tutorial 4--Edit and Debug script

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.