EXT 4 Overview (iii) ENV namespace & Language Enhancement package & Ext. Function

Source: Internet
Author: User
Env namespace

Provides information about browsers and operations, and tells us what functions modern browsers provide.

Ext. Env. Browser

This class provides metadata of all browsers (names, engines, versions, strict mode, etc.) for Global Object Ext.

Ext. Env. featuredetector

This is a completely new function that does not have a class in ext3. Its function is to detect the features of the browser, mainly for the features of modern HTML5 and css3, including the features list of mobile platforms, including:

  • CSS deformation, animation, and conversion
  • Canvas, SVG, VML
  • Touch capability and direction
  • Navigation Geolocation
  • Sqldatabase
  • Websockets
  • History
  • Audio
  • Video

Ext. Env. OS

Provides information about the operating system of the current host (including the mobile OS list ).

Language Pack (lang Package)

The same functions are available in ext, but this is a new package. The reason why it is defined as a new package is to try not to affect the JavaScript Object prototype. Although it is easier to set the method in the object prototype, if other Javascript is introduced, it is hard to say whether it will constitute a conflict or impact. Furthermore, if the ecmascript specification is revised in the future, will it overlap with what ext defines? Therefore, to solve the above concerns, we should define the namespace of the language method under the ext object to avoid defining members in the object prototype.

In fact, although there is not a namespace such as "Lang", a file is still divided into source tree to define language enhancement functions. The changes are as follows:

  • Array → Ext. Array
  • Date → Ext. Date
  • Function → Ext. Function
  • Number → Ext. Number
  • Object → Ext. Object
  • String → Ext. String

Note that the core object's prototype mounting method will still be referenced in compatible files. To upgrade to ext 4 and get rid of the old call method of ext 3, you must remove the compatible file and upgrade it to the new namespace form.

Ext. Function

How can I call the function prototype of ext 4 after it is changed? The most important thing is that the name changes, such as function. createdelegate () and function. createcallback () is renamed to Ext. function. BIND () and ext. function (); function. defer () Changes to Ext. function. defer (). Because of the high usage frequency, we have added a quick access method to the ext object, namely Ext. Bind, ext. Pass, and Ext. Defer. Other function methods are like
Createsequence () and createinterceptor () are canceled, but the new methods createbuffered () and createthrottled () are introduced to check the purpose.

The following are some syntactic sugar descriptions before and after the change:

// Ext 3: <br/> myfunction. createdelegate (this, [arg1, arg2]); <br/> myfunction. defer (1000, this); </P> <p> // ext 4: <br/> Ext. BIND (myfunction, this, [arg1, arg2]; <br/> Ext. defer (myfunction, 1000, this );

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.