For up to date documentation and features, visit http://docs.sencha.com/ext-js/4-0

Sencha Documentation

A utility class that wrap around a string version number and provide convenient method to perform comparison. See also: compare. Example:

var version = new Ext.Version('1.0.2beta');
console.log("Version is " + version); // Version is 1.0.2beta

console.log(version.getMajor()); // 1
console.log(version.getMinor()); // 0
console.log(version.getPatch()); // 2
console.log(version.getBuild()); // 0
console.log(version.getRelease()); // beta

console.log(version.isGreaterThan('1.0.1')); // True
console.log(version.isGreaterThan('1.0.2alpha')); // True
console.log(version.isGreaterThan('1.0.2RC')); // False
console.log(version.isGreaterThan('1.0.2')); // False
console.log(version.isLessThan('1.0.2')); // True

console.log(version.match(1.0)); // True
console.log(version.match('1.0.2')); // True
Defined By

Methods

 
Version( String/Number version, Object version) : Ext.Version

 

Parameters

  • version : String/Number

    The version number in the follow standard format: major[.minor[.patch[.build[release]]]] Examples: 1.0 or 1.2.3beta or 1.2.3.4RC

  • version : Object

Returns

  • Ext.Version   

    this

 
compare( String current, String target) : Number
Compare 2 specified versions, starting from left to right. If a part contains special version strings, they are handl...

Compare 2 specified versions, starting from left to right. If a part contains special version strings, they are handled in the following order: 'dev' < 'alpha' = 'a' < 'beta' = 'b' < 'RC' = 'rc' < '#' < 'pl' = 'p' < 'anything else'

Parameters

  • current : String

    The current version to compare to

  • target : String

    The target version to compare to

Returns

  • Number   

    Returns -1 if the current version is smaller than the target version, 1 if greater, and 0 if they're equivalent

 
deprecate( String packageName, String since, Function closure, Object scope) : void
Create a closure for deprecated code. // This means Ext.oldMethod is only supported in 4.0.0beta and older. // If Ex...

Create a closure for deprecated code.

// This means Ext.oldMethod is only supported in 4.0.0beta and older.
// If Ext.getVersion('extjs') returns a version that is later than '4.0.0beta', for example '4.0.0RC',
// the closure will not be invoked
Ext.deprecate('extjs', '4.0.0beta', function() {
    Ext.oldMethod = Ext.newMethod;

    ...
});

Parameters

  • packageName : String

    The package name

  • since : String

    The last version before it's deprecated

  • closure : Function

    The callback function to be executed with the specified version is less than the current version

  • scope : Object

    The execution scope (this) if the closure

Returns

  • void   
 
equals( String/Number target) : Boolean

Returns whether this version equals to the supplied argument

Returns whether this version equals to the supplied argument

Parameters

  • target : String/Number

    The version to compare with

Returns

  • Boolean   

    True if this version equals to the target, false otherwise

 

Returns the build component value

Returns the build component value

Returns

  • Number   

    build

 

Converts a version component to a comparable value

Converts a version component to a comparable value

Parameters

  • value : Mixed

    The value to convert

Returns

  • Mixed   
 

Returns the major component value

Returns the major component value

Returns

  • Number   

    major

 

Returns the minor component value

Returns the minor component value

Returns

  • Number   

    minor

 

Returns the patch component value

Returns the patch component value

Returns

  • Number   

    patch

 

Returns the release component value

Returns the release component value

Returns

  • Number   

    release

 

Returns shortVersion version without dots and release

Returns shortVersion version without dots and release

Returns

  • String   
 
getVersion( String packageName) : Ext.Version
Get the version number of the supplied package name; will return the last registered version (last Ext.setVersion cal...

Get the version number of the supplied package name; will return the last registered version (last Ext.setVersion call) if there's no package name given.

Parameters

  • packageName : String

    (Optional) The package name, for example: 'core', 'touch', 'extjs'

Returns

  • Ext.Version   

    The version

 
isGreaterThan( String/Number target) : Boolean

Returns whether this version if greater than the supplied argument

Returns whether this version if greater than the supplied argument

Parameters

  • target : String/Number

    The version to compare with

Returns

  • Boolean   

    True if this version if greater than the target, false otherwise

 
isLessThan( String/Number target) : Boolean

Returns whether this version if smaller than the supplied argument

Returns whether this version if smaller than the supplied argument

Parameters

  • target : String/Number

    The version to compare with

Returns

  • Boolean   

    True if this version if smaller than the target, false otherwise

 
match( String/Number target) : Boolean
Returns whether this version matches the supplied argument. Example: var version = new Ext.Version('1.0.2beta'); con...

Returns whether this version matches the supplied argument. Example:

var version = new Ext.Version('1.0.2beta');
console.log(version.match(1)); // True
console.log(version.match(1.0)); // True
console.log(version.match('1.0.2')); // True
console.log(version.match('1.0.2RC')); // False

Parameters

  • target : String/Number

    The version to compare with

Returns

  • Boolean   

    True if this version matches the target, false otherwise

 
setVersion( String packageName, String/Ext.Version version) : Ext

Set version number for the given package name.

Set version number for the given package name.

Parameters

  • packageName : String

    The package name, for example: 'core', 'touch', 'extjs'

  • version : String/Ext.Version

    The version, for example: '1.2.3alpha', '2.4.0-dev'

Returns

  • Ext   
 

Returns this format: [major, minor, patch, build, release]. Useful for comparison

Returns this format: [major, minor, patch, build, release]. Useful for comparison

Returns

  • Array