Parsing a method that enables JavaScript support for browsers

Source: Internet
Author: User
Tags reference

First, the basic JavaScript development environment

JavaScript reference and JavaScript APIs:

The JavaScript reference is used to create a library or DLL that contains JavaScript runtime, and then compile into a small "shell" program that connects the library and generates an interactive JavaScript interpreter. can also be used to interpret. js files.

The program does not rely on navigator code.

The generated shell program, which compares browser support to JavaScript, uses the same library or DLL that contains JavaScript runtime, and we call this part of the library or dll the JavaScript API , we actually develop JavaScript applications and work on the JavaScript API, without too much consideration for internal implementations. For a JavaScript API, see the JavaScript API detailed.

Second, JavaScript Engine

JavaScript engine is used to initialize the JavaScript environment, providing an interface for JavaScript interpretation and execution.

Initialization mainly includes:

Memory allocation: Rt=js_init (10000L);

Initialize CX:CX = Js_newcontext (RT, stack_chunk_size);

Initialize globalobj:globalobj = Js_newobject (CX, &globalclass, 0, 0);

Define Standard classes: js_initstandardclasses (CX, globalobj);

Define system functions: Js_definefunctions (CX, Globalobj, g_functions);

Define the Error function: Js_seterrorreporter (cx,js_errorreporter);

Register Other classes:

Registerclasspoint (Cx,globalobj);

Registerclasssize (Cx,globalobj);

Registerclassrect (Cx,globalobj);

Registerclasspolygon (Cx,globalobj);

Registerclasscolorkey (Cx,globalobj);

Registerclasstdtimer (Cx,globalobj);

Initialization timer: Tdtimerlistinit ();

Provides an interface function to interpret and execute javascript:

Td_evaluatescript (Jscontext *cx,

Jsobject *obj,

const Char *bytes,

Uintn length,

const Char *filename,

Uintn Lineno,

Jsval *rval)

Related Article

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.