Hierarchy
Ext.BaseExt.env.Browser
Provide useful information about the current browser. Should not be manually instantiated unless for unit-testing; access the global instance stored in Ext.browser instead. Example:
if (Ext.browser.is.IE) {
// IE specific code here
}
if (Ext.browser.is.WebKit) {
// WebKit specific code here
}
console.log("Version " + Ext.browser.version);
For a full list of supported values, refer to: is
@borrows Ext.Base.extend
Add / override static properties of this class.
Ext.define('My.cool.Class', {
...
});
My.cool.Class.addStatics({
someProperty: 'someValue', // My.cool.Class.someProperty = 'someValue'
method1: function() { ... }, // My.cool.Class.method1 = function() { ... };
method2: function() { ... } // My.cool.Class.method2 = function() { ... };
});
Borrow another class' members to the prototype of this class.
Ext.define('Bank', {
money: '$$$',
printMoney: function() {
alert('$$$$$$$');
}
});
Ext.define('Thief', {
...
});
Thief.borrow(Bank, ['money', 'printMoney']);
var steve = new Thief();
alert(steve.money); // alerts '$$$' steve.printMoney(); // alerts '$$$$$$$'
Create a new instance of this Class. Ext.define('My.cool.Class', {
...
});
My.cool.Class.create({
someConfig: true
});
Create aliases for existing prototype methods. Example:
Ext.define('My.cool.Class', {
method1: function() { ... },
method2: function() { ... }
});
var test = new My.cool.Class();
My.cool.Class.createAlias({
method3: 'method1',
method4: 'method2'
});
test.method3(); // test.method1()
My.cool.Class.createAlias('method5', 'method3');
test.method5(); // test.method3() -> test.method1()
Read-only - the full name of the current browser's engine Possible values are: WebKit, Gecko, Presto, Trident and Other
Read-only - the full name of the current browser's engine Possible values are: WebKit, Gecko, Presto, Trident and Other
Add methods / properties to the prototype of this class.
Ext.define('My.awesome.Cat', {
constructor: function() {
...
}
});
My.awesome.Cat.implement({
meow: function() {
alert('Meowww...');
}
});
var kitty = new My.awesome.Cat;
kitty.meow();
A "hybrid" property, can be either accessed as a method call, i.e:
if (Ext.browser.is('IE')) { ... }
or as an object with boolean properties, i.e:
if (Ext.browser.is.IE) { ... }
Versions can be conveniently checked as well. For example:
if (Ext.browser.is.IE6) { ... } // Equivalent to (Ext.browser.is.IE && Ext.browser.version.equals(6))
Note that only major component and shortVersion value of the version are available via direct property checking.
Supported values are: IE, Firefox, Safari, Chrome, Opera, WebKit, Gecko, Presto, Trident and Other
Read-only - the full name of the current browser Possible values are: IE, Firefox, Safari, Chrome, Opera and Other
Read-only - the full name of the current browser Possible values are: IE, Firefox, Safari, Chrome, Opera and Other
Override prototype members of this class. Overridden methods can be invoked via Ext.Base.callOverridden
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
return this;
}
});
My.Cat.override({
constructor: function() {
alert("I'm going to be a cat!");
var instance = this.callOverridden();
alert("Meeeeoooowwww");
return instance;
}
});
var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
// alerts "I'm a cat!"
// alerts "Meeeeoooowwww"
Call the original method that was previously overridden with Ext.Base.override
Ext.define('My.Cat', {
constructor: function() {
alert("I'm a cat!");
return this;
}
});
My.Cat.override({
constructor: function() {
alert("I'm going to be a cat!");
var instance = this.callOverridden();
alert("Meeeeoooowwww");
return instance;
}
});
var kitty = new My.Cat(); // alerts "I'm going to be a cat!"
// alerts "I'm a cat!"
// alerts "Meeeeoooowwww"
The arguments, either an array or the arguments
object
Returns the result after calling the overridden method
Get the current class' name in string format.
Ext.define('My.cool.Class', {
constructor: function() {
alert(this.self.getName()); // alerts 'My.cool.Class'
}
});
My.cool.Class.getName(); // 'My.cool.Class'
className