Upgrade to ExtJS 4.0.0 - Released 04/26/2011
[extjs.git] / docs / api / Ext.Version.html
1 <!DOCTYPE html><html><head><title>Ext.Version | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
2 <style type="text/css">.head-band { display: none; }
3 .header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
4 .doc-tab .members .member a.more { background-color: #efefef; }
5 </style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
6 </head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
7 <a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">
8
9     req = {
10         liveURL: '.',
11         standAloneMode: true,
12         origDocClass: 'Ext.Version',
13         docClass: 'Ext.Version',
14         docReq: 'Ext.Version',
15         version: '4.0',
16         baseURL: '.',
17         baseDocURL: '.',
18         baseProdURL: '.'
19     };
20
21     clsInfo = {};
22
23
24
25 </script>
26
27 <script type="text/javascript" src="../search.js"></script>
28 <!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
29 <script type="text/javascript" src="../class_tree.js"></script>
30 <script type="text/javascript" src="../class_doc.js"></script>
31 <script type="text/javascript">
32     req.source = 'Version.html#Ext-Version';
33     clsInfo = {"methods":["Version","compare","deprecate","equals","getBuild","getComponentValue","getMajor","getMinor","getPatch","getRelease","getShortVersion","getVersion","isGreaterThan","isLessThan","match","setVersion","toArray"],"cfgs":[],"properties":[],"events":[],"subclasses":[]};
34     Ext.onReady(function() {
35         Ext.create('Docs.classPanel');
36     });
37 </script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/Version.html#Ext-Version" target="_blank">Ext.Version</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>A utility class that wrap around a string version number and provide convenient
38 method to perform comparison. See also: <a href="Ext.Version.html#compare" rel="Ext.Version#compare" class="docClass">compare</a>. Example:</p>
39
40 <pre class="prettyprint"><code>var version = new Ext.Version('1.0.2beta');
41 console.log("Version is " + version); // Version is 1.0.2beta
42
43 console.log(version.getMajor()); // 1
44 console.log(version.getMinor()); // 0
45 console.log(version.getPatch()); // 2
46 console.log(version.getBuild()); // 0
47 console.log(version.getRelease()); // beta
48
49 console.log(version.isGreaterThan('1.0.1')); // True
50 console.log(version.isGreaterThan('1.0.2alpha')); // True
51 console.log(version.isGreaterThan('1.0.2RC')); // False
52 console.log(version.isGreaterThan('1.0.2')); // False
53 console.log(version.isLessThan('1.0.2')); // True
54
55 console.log(version.match(1.0)); // True
56 console.log(version.match('1.0.2')); // True
57 </code></pre>
58 <div class="members"><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-Version" class="member f ni"><a href="Ext.Version.html#method-Version" rel="method-Version" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-constructor" class="viewSource">view source</a></div><a name="Version"></a><a name="method-Version"></a><a href="Ext.Version.html#" rel="method-Version" class="cls expand">Version</a>(
59 <span class="pre">String/Number version, Object version</span>)
60  : Ext.Version</div><div class="description"><div class="short"><p>&nbsp;</p></div><div class="long">
61 <h3 class="pa">Parameters</h3><ul><li><span class="pre">version</span> : String/Number<div class="sub-desc"><p>The version number in the follow standard format: major[.minor[.patch[.build[release]]]]
62 Examples: 1.0 or 1.2.3beta or 1.2.3.4RC</p>
63 </div></li><li><span class="pre">version</span> : Object<div class="sub-desc">
64 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Ext.Version</span>&nbsp; &nbsp;<p>this</p>
65 </li></ul></div></div></div><div id="method-compare" class="member ni"><a href="Ext.Version.html#method-compare" rel="method-compare" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-compare" class="viewSource">view source</a></div><a name="compare"></a><a name="method-compare"></a><a href="Ext.Version.html#" rel="method-compare" class="cls expand">compare</a>(
66 <span class="pre">String current, String target</span>)
67  : Number</div><div class="description"><div class="short">Compare 2 specified versions, starting from left to right. If a part contains special version strings,
68 they are handl...</div><div class="long"><p>Compare 2 specified versions, starting from left to right. If a part contains special version strings,
69 they are handled in the following order:
70 'dev' &lt; 'alpha' = 'a' &lt; 'beta' = 'b' &lt; 'RC' = 'rc' &lt; '#' &lt; 'pl' = 'p' &lt; 'anything else'</p>
71 <h3 class="pa">Parameters</h3><ul><li><span class="pre">current</span> : String<div class="sub-desc"><p>The current version to compare to</p>
72 </div></li><li><span class="pre">target</span> : String<div class="sub-desc"><p>The target version to compare to</p>
73 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>Returns -1 if the current version is smaller than the target version, 1 if greater, and 0 if they're equivalent</p>
74 </li></ul></div></div></div><div id="method-deprecate" class="member ni"><a href="Ext.Version.html#method-deprecate" rel="method-deprecate" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-deprecate" class="viewSource">view source</a></div><a name="deprecate"></a><a name="method-deprecate"></a><a href="Ext.Version.html#" rel="method-deprecate" class="cls expand">deprecate</a>(
75 <span class="pre">String packageName, String since, Function closure, Object scope</span>)
76  : void</div><div class="description"><div class="short">Create a closure for deprecated code.
77
78 // This means Ext.oldMethod is only supported in 4.0.0beta and older.
79 // If Ex...</div><div class="long"><p>Create a closure for deprecated code.</p>
80
81 <pre><code>// This means Ext.oldMethod is only supported in 4.0.0beta and older.
82 // If Ext.getVersion('extjs') returns a version that is later than '4.0.0beta', for example '4.0.0RC',
83 // the closure will not be invoked
84 Ext.deprecate('extjs', '4.0.0beta', function() {
85     Ext.oldMethod = Ext.newMethod;
86
87     ...
88 });
89 </code></pre>
90 <h3 class="pa">Parameters</h3><ul><li><span class="pre">packageName</span> : String<div class="sub-desc"><p>The package name</p>
91 </div></li><li><span class="pre">since</span> : String<div class="sub-desc"><p>The last version before it's deprecated</p>
92 </div></li><li><span class="pre">closure</span> : Function<div class="sub-desc"><p>The callback function to be executed with the specified version is less than the current version</p>
93 </div></li><li><span class="pre">scope</span> : Object<div class="sub-desc"><p>The execution scope (<tt>this</tt>) if the closure</p>
94 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">void</span>&nbsp; &nbsp;
95 </li></ul></div></div></div><div id="method-equals" class="member ni"><a href="Ext.Version.html#method-equals" rel="method-equals" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-equals" class="viewSource">view source</a></div><a name="equals"></a><a name="method-equals"></a><a href="Ext.Version.html#" rel="method-equals" class="cls expand">equals</a>(
96 <span class="pre">String/Number target</span>)
97  : Boolean</div><div class="description"><div class="short"><p>Returns whether this version equals to the supplied argument</p>
98 </div><div class="long"><p>Returns whether this version equals to the supplied argument</p>
99 <h3 class="pa">Parameters</h3><ul><li><span class="pre">target</span> : String/Number<div class="sub-desc"><p>The version to compare with</p>
100 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if this version equals to the target, false otherwise</p>
101 </li></ul></div></div></div><div id="method-getBuild" class="member ni"><a href="Ext.Version.html#method-getBuild" rel="method-getBuild" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getBuild" class="viewSource">view source</a></div><a name="getBuild"></a><a name="method-getBuild"></a><a href="Ext.Version.html#" rel="method-getBuild" class="cls expand">getBuild</a> : Number</div><div class="description"><div class="short"><p>Returns the build component value</p>
102 </div><div class="long"><p>Returns the build component value</p>
103 <h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>build</p>
104 </li></ul></div></div></div><div id="method-getComponentValue" class="member ni"><a href="Ext.Version.html#method-getComponentValue" rel="method-getComponentValue" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getComponentValue" class="viewSource">view source</a></div><a name="getComponentValue"></a><a name="method-getComponentValue"></a><a href="Ext.Version.html#" rel="method-getComponentValue" class="cls expand">getComponentValue</a>(
105 <span class="pre">Mixed value</span>)
106  : Mixed</div><div class="description"><div class="short"><p>Converts a version component to a comparable value</p>
107 </div><div class="long"><p>Converts a version component to a comparable value</p>
108 <h3 class="pa">Parameters</h3><ul><li><span class="pre">value</span> : Mixed<div class="sub-desc"><p>The value to convert</p>
109 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Mixed</span>&nbsp; &nbsp;
110 </li></ul></div></div></div><div id="method-getMajor" class="member ni"><a href="Ext.Version.html#method-getMajor" rel="method-getMajor" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getMajor" class="viewSource">view source</a></div><a name="getMajor"></a><a name="method-getMajor"></a><a href="Ext.Version.html#" rel="method-getMajor" class="cls expand">getMajor</a> : Number</div><div class="description"><div class="short"><p>Returns the major component value</p>
111 </div><div class="long"><p>Returns the major component value</p>
112 <h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>major</p>
113 </li></ul></div></div></div><div id="method-getMinor" class="member ni"><a href="Ext.Version.html#method-getMinor" rel="method-getMinor" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getMinor" class="viewSource">view source</a></div><a name="getMinor"></a><a name="method-getMinor"></a><a href="Ext.Version.html#" rel="method-getMinor" class="cls expand">getMinor</a> : Number</div><div class="description"><div class="short"><p>Returns the minor component value</p>
114 </div><div class="long"><p>Returns the minor component value</p>
115 <h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>minor</p>
116 </li></ul></div></div></div><div id="method-getPatch" class="member ni"><a href="Ext.Version.html#method-getPatch" rel="method-getPatch" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getPatch" class="viewSource">view source</a></div><a name="getPatch"></a><a name="method-getPatch"></a><a href="Ext.Version.html#" rel="method-getPatch" class="cls expand">getPatch</a> : Number</div><div class="description"><div class="short"><p>Returns the patch component value</p>
117 </div><div class="long"><p>Returns the patch component value</p>
118 <h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>patch</p>
119 </li></ul></div></div></div><div id="method-getRelease" class="member ni"><a href="Ext.Version.html#method-getRelease" rel="method-getRelease" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getRelease" class="viewSource">view source</a></div><a name="getRelease"></a><a name="method-getRelease"></a><a href="Ext.Version.html#" rel="method-getRelease" class="cls expand">getRelease</a> : Number</div><div class="description"><div class="short"><p>Returns the release component value</p>
120 </div><div class="long"><p>Returns the release component value</p>
121 <h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>release</p>
122 </li></ul></div></div></div><div id="method-getShortVersion" class="member ni"><a href="Ext.Version.html#method-getShortVersion" rel="method-getShortVersion" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getShortVersion" class="viewSource">view source</a></div><a name="getShortVersion"></a><a name="method-getShortVersion"></a><a href="Ext.Version.html#" rel="method-getShortVersion" class="cls expand">getShortVersion</a> : String</div><div class="description"><div class="short"><p>Returns shortVersion version without dots and release</p>
123 </div><div class="long"><p>Returns shortVersion version without dots and release</p>
124 <h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;
125 </li></ul></div></div></div><div id="method-getVersion" class="member ni"><a href="Ext.Version.html#method-getVersion" rel="method-getVersion" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-getVersion" class="viewSource">view source</a></div><a name="getVersion"></a><a name="method-getVersion"></a><a href="Ext.Version.html#" rel="method-getVersion" class="cls expand">getVersion</a>(
126 <span class="pre">String packageName</span>)
127  : Ext.Version</div><div class="description"><div class="short">Get the version number of the supplied package name; will return the last registered version
128 (last Ext.setVersion cal...</div><div class="long"><p>Get the version number of the supplied package name; will return the last registered version
129 (last Ext.setVersion call) if there's no package name given.</p>
130 <h3 class="pa">Parameters</h3><ul><li><span class="pre">packageName</span> : String<div class="sub-desc"><p>(Optional) The package name, for example: 'core', 'touch', 'extjs'</p>
131 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Ext.Version</span>&nbsp; &nbsp;<p>The version</p>
132 </li></ul></div></div></div><div id="method-isGreaterThan" class="member ni"><a href="Ext.Version.html#method-isGreaterThan" rel="method-isGreaterThan" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-isGreaterThan" class="viewSource">view source</a></div><a name="isGreaterThan"></a><a name="method-isGreaterThan"></a><a href="Ext.Version.html#" rel="method-isGreaterThan" class="cls expand">isGreaterThan</a>(
133 <span class="pre">String/Number target</span>)
134  : Boolean</div><div class="description"><div class="short"><p>Returns whether this version if greater than the supplied argument</p>
135 </div><div class="long"><p>Returns whether this version if greater than the supplied argument</p>
136 <h3 class="pa">Parameters</h3><ul><li><span class="pre">target</span> : String/Number<div class="sub-desc"><p>The version to compare with</p>
137 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if this version if greater than the target, false otherwise</p>
138 </li></ul></div></div></div><div id="method-isLessThan" class="member ni"><a href="Ext.Version.html#method-isLessThan" rel="method-isLessThan" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-isLessThan" class="viewSource">view source</a></div><a name="isLessThan"></a><a name="method-isLessThan"></a><a href="Ext.Version.html#" rel="method-isLessThan" class="cls expand">isLessThan</a>(
139 <span class="pre">String/Number target</span>)
140  : Boolean</div><div class="description"><div class="short"><p>Returns whether this version if smaller than the supplied argument</p>
141 </div><div class="long"><p>Returns whether this version if smaller than the supplied argument</p>
142 <h3 class="pa">Parameters</h3><ul><li><span class="pre">target</span> : String/Number<div class="sub-desc"><p>The version to compare with</p>
143 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if this version if smaller than the target, false otherwise</p>
144 </li></ul></div></div></div><div id="method-match" class="member ni"><a href="Ext.Version.html#method-match" rel="method-match" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-match" class="viewSource">view source</a></div><a name="match"></a><a name="method-match"></a><a href="Ext.Version.html#" rel="method-match" class="cls expand">match</a>(
145 <span class="pre">String/Number target</span>)
146  : Boolean</div><div class="description"><div class="short">Returns whether this version matches the supplied argument. Example:
147
148 var version = new Ext.Version('1.0.2beta');
149 con...</div><div class="long"><p>Returns whether this version matches the supplied argument. Example:</p>
150
151 <pre><code>var version = new Ext.Version('1.0.2beta');
152 console.log(version.match(1)); // True
153 console.log(version.match(1.0)); // True
154 console.log(version.match('1.0.2')); // True
155 console.log(version.match('1.0.2RC')); // False
156 </code></pre>
157
158 <h3 class="pa">Parameters</h3><ul><li><span class="pre">target</span> : String/Number<div class="sub-desc"><p>The version to compare with</p>
159 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Boolean</span>&nbsp; &nbsp;<p>True if this version matches the target, false otherwise</p>
160 </li></ul></div></div></div><div id="method-setVersion" class="member ni"><a href="Ext.Version.html#method-setVersion" rel="method-setVersion" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-setVersion" class="viewSource">view source</a></div><a name="setVersion"></a><a name="method-setVersion"></a><a href="Ext.Version.html#" rel="method-setVersion" class="cls expand">setVersion</a>(
161 <span class="pre">String packageName, String/Ext.Version version</span>)
162  : Ext</div><div class="description"><div class="short"><p>Set version number for the given package name.</p>
163 </div><div class="long"><p>Set version number for the given package name.</p>
164 <h3 class="pa">Parameters</h3><ul><li><span class="pre">packageName</span> : String<div class="sub-desc"><p>The package name, for example: 'core', 'touch', 'extjs'</p>
165 </div></li><li><span class="pre">version</span> : String/Ext.Version<div class="sub-desc"><p>The version, for example: '1.2.3alpha', '2.4.0-dev'</p>
166 </div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Ext</span>&nbsp; &nbsp;
167 </li></ul></div></div></div><div id="method-toArray" class="member ni"><a href="Ext.Version.html#method-toArray" rel="method-toArray" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.Version.html" class="definedIn docClass">Ext.Version</a><br/><a href="../source/Version.html#Ext-Version-method-toArray" class="viewSource">view source</a></div><a name="toArray"></a><a name="method-toArray"></a><a href="Ext.Version.html#" rel="method-toArray" class="cls expand">toArray</a> : Array</div><div class="description"><div class="short"><p>Returns this format: [major, minor, patch, build, release]. Useful for comparison</p>
168 </div><div class="long"><p>Returns this format: [major, minor, patch, build, release]. Useful for comparison</p>
169 <h3 class="pa">Returns</h3><ul><li><span class="pre">Array</span>&nbsp; &nbsp;
170 </li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>