1,
EXT. Apply(Object OBJ, object config, object defaults): Object
Copy all the attributes in config to OBJ. If ults is configured, pass the attributes in defaults into OBJ and then the attributes in config. Generally, defaults is used to define some default values.
Note: Each parameter must be an object, not a function or other parameter.
You can use new function () {}, new object (), {}, and other methods to create an object.
2,EXT. Emptyfn: Function
Returns an empty function to create an empty function in the program.EXT. Emptyfn Returns function (){}
3,EXT. Applyif(Object OBJ, object config): Object
FunctionsEXT. Apply, but only copy the property that exists in config but does not exist in OBJ.
4,EXT. Addbehaviors(Object OBJ): void
Add events to one or more elements on the page
Elements are searched by CSS rules, and elements and events are separated @.EXT. Addbehaviors ({
// Add a click event for all a elements under the element whose ID is foo
'# Foo A @ click': function (E, T ){
// Do something
},
// Add the same event (Mouseover) to multiple selectors ). Separate by commas before @
'# Foo A, # bar span. Some-class @ Mouseover': function (){
// Do something
}
});
5,EXT. ID([Mixed El], [String prefix]): String
Returns a unique ID value.
If you only need to obtain a unique ID value, you can directly callEXT. ID ();
If you need to set a unique ID value for an element and return the ID, callEXT. ID (EL), El is the element ID, DOM object orEXT.
If you need to specify a specific prefix, You need to input the second parameter, as shown in figureEXT. ID (El, "myprix-"). The default prefix isEXT-Gen. If the default return ID may beEXT-Gen4, A myPrix-4 may be returned after a prefix is specified.
6,EXT.EXTEnd(Object subclass, object superclass, [object overrides]): void
How does one implement Object Inheritance ???
7,EXT. Namespace(String namespace1, string namespace2, string etc): void
Create a namespace:
For exampleEXT. Namespace ("company", "myns. mydata", "data. format. String ")
Then you can create a function such as myns. mydata. doit = function (){...} Interface
Note: simple namespace call:EXT. NS (), inEXTThis usage is not provided in the API.
8,EXT. Urlencode(Object O): String
Converts a JSON object to a URL parameter string. You can use arrays to set multiple values for a parameter.
For example, {A: 1, B: 2, C: [1, 3, 5, 7]} To A = 1 & B = 2 & C = 1 & C = 3 & C = 5 & C = 7
9,EXT. Urldecode(String, [Boolean overwrite]): Object
Convert the URL parameter string to a JSON object. If the value of overwrite is true, the value of the parameter with the same name after overwrite overwrites the value of the preceding parameter with the same name (false by default ).
For exampleEXT. Urldecode ("A = 1 & B = 2 & C = 1 & C = 3 & C = 5 & C = 7 ")
The returned object content is {A: 1, B: 2, C: [,]}.
EXT. Urldecode ("A = 1 & B = 2 & C = 1 & C = 3 & C = 5 & C = 7", true)
Returns {A: 1, B: 2, C: 7}
10,EXT. Each(Array/nodelist/Mixed Array, function FN, object scope): void
Traverse the array and call the FN function for each item. If array is not an array, it is executed only once.
If a FN execution result returns false (must be false, undefined is invalid), The traversal exits and the subsequent array items are not traversed.
During the traversal process, the incoming parameters for FN are [current array item], [current index], and [array.
Scope is used to set the this pointer in the FN function.
For exampleEXT. Each ([1, 3, 5, 7], function (V, I, ){
Alert ("index:" + I + "value:" + V + "array. Length:" + A. length)
});
The following dialog box appears:
Index: 0 value: 1 array. Length: 4
Index: 1 Value: 3 array. Length: 4
Index: 2 value: 5 array. Length: 4
Index: 3 value: 7 array. Length: 4
EXT. Each ([1, 3, 5, 7], function (V, I, ){
Alert ("index:" + I + "value:" + V + "array. Length:" + A. Length );
Return V! = 5; // traverse and exit after the third entry
});
The following dialog box appears:
Index: 0 value: 1 array. Length: 4
Index: 1 Value: 3 array. Length: 4
Index: 2 value: 5 array. Length: 4
11,EXT. Combine(Arg1, arg2.. argn): array // The method inEXT2. It is not recommended to use it again.
It is used to merge arrays. If it is a string, it is merged as an array with only one item.
For example, VAR a1 = [1, 3, 5], b1 = ["A", "B", "C"]; var C1 = "xxyznbde ";
EXT. Combine (A1, B1, C1) Returns [1, 3, 5, a, B, c, xxyznbde]
12,EXT. Escapere(String Str): String
Escape special characters in the regular expression.
For exampleEXT. Escapere ("(AB) $/sa342 {} [DD]") returns/(AB/)/$ sa342/{/}/[DD/].
13,EXT. Callback(CB, scope, argS, delay): void // This method isEXTInternal method
Call a function or call a function by delay.
CB: The called function.
Scope: This pointer in CB.
ARGs: the input parameters, such as CB, are represented in arrays.
Delay: the number of milliseconds after which CB is executed.
For exampleEXT. Callback (function (x, y) {alert (x + y)}, this, [3, 5], 1000); the result of 3 + 5 is displayed in one second.
14,EXT. Getdom(Mixed El): htmlelement
Based on the input ID/DOM node/EXTAnd returns its DOM object.
For example, alert (EXT. Getdom ("A"). innerhtml); or
Alert (EXT. Getdom (document. getelementbyid ("A"). innerhtml );
The innerhtml content of the element with ID a is returned.
15,EXT. Getdoc ()/EXT. Getbody ():EXT. Element
Return the Document Object and body object of the page respectively. The return value isEXTInstead of DOM object.
16,EXT. Getcmp(String ID ):EXT. Component
The component type of the input HTML element ID is returned. The returned value isEXT.
The element of this ID object must beEXTAn internal componentEXTCreated component). Otherwise, nothing is returned.
17,EXT. Num(Mixed value, number defaultvalue): Number
Verify whether the value is a number. If yes, return the defaultvalue directly. Otherwise, return the defaultvalue.
For example, alert (EXT. Num (5, 7) returns 5, alert (EXT. Num ("5", 7) returns 7
18,EXT. Destroy(Mixed arg1, mixed (optional), mixed (optional): void
Destroy the created element or component, that is, destroy all its event listening and DOM nodes, and call the destory method of the object (if any). The input parameter type isEXT. Element orEXT. Component. Multiple objects can be imported at one time for destruction.
For exampleEXT. Destory (menu, El, button); destroys the menu, El, And button objects.
19,EXT. Removenode(Htmlelement El): void //EXTInternal Method
Deletes a specified Dom node. The input parameter is a DOM object.
For exampleEXT. Removenode (document. getelementbyid ("AB "));
20,EXT. Type(Mixed object): String
Returns the type of the input object.
Including the following types:
String, number, Boolean, function, object, array, Regexp, element, nodelist, TEXTNode, whitespace
For exampleEXT. Type ("AB") returns string
EXT. Type (20) Returns number
EXT. Type ([3, 5, 6]) returns Array
EXT. Type (/REG/) returns Regexp
EXT. Type (document. Body) returns element.
21,EXT. Isempty(Mixed value, [Boolean allowblank]): Boolean
Check whether a value is null/undefined or null. If yes, return true.
If the input allowblank is true, only check whether it is null or undefined.
For example:EXT. Isempty ("A") returns false,
EXT. Isempty ("") returns true,
EXT. Isempty ("", true) returns false,
EXT. Isempty (null) returns true.
22,EXT. Value(String V, string defaultvalue [, [Boolean allowblank]): String //EXTInternal Method
Check whether V is null/undefined or null. If yes, defavalue value is returned; otherwise, V is returned. If the allowblank parameter is true, the value of V is allowed to be null (that is, if the value of V is null, defavalue value is not returned and null is returned ).