pull/227/head
Denis Demchenko 6 years ago
parent 3a9c4b3a3d
commit 31b9240aec

@ -103,7 +103,7 @@ const isValidBrowser = bowser.compare({
});
```
As you can see, settings for any particular OS has more priority and redefines settings of `any` property.
Settings for any particular OS has more priority and redefines settings of standalone browsers.
### new Bowser(`:Object`)
Use it to get object with detected flags of your current browser.
@ -170,11 +170,6 @@ For unknown browsers, Bowser makes a best guess from the UA string. So, these m
### Rendering engine flags
If detected, one of these flags may be set to true:
* `webkit` - Chrome 0-27, Android <4.4, iOs, BB, etc.
* `blink` - Chrome >=28, Android >=4.4, Opera, etc.
* `gecko` - Firefox, etc.
* `msie` - IE <= 11
* `msedge` - IE > 11
Safari, Chrome and some other minor browsers will report that they have `webkit` engines.
Firefox and Seamonkey will report that they have `gecko` engines.

@ -559,7 +559,7 @@ bowser.getResult()</code></pre>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:09:12 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:30:49 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

@ -277,7 +277,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line105">line 105</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line110">line 110</a>
</li></ul></dd>
@ -379,7 +379,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line119">line 119</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line124">line 124</a>
</li></ul></dd>
@ -485,7 +485,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line133">line 133</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line138">line 138</a>
</li></ul></dd>
@ -591,7 +591,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line262">line 262</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line267">line 267</a>
</li></ul></dd>
@ -693,7 +693,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line148">line 148</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line153">line 153</a>
</li></ul></dd>
@ -804,7 +804,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line187">line 187</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line192">line 192</a>
</li></ul></dd>
@ -971,7 +971,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line201">line 201</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line206">line 206</a>
</li></ul></dd>
@ -1077,7 +1077,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line209">line 209</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line214">line 214</a>
</li></ul></dd>
@ -1179,7 +1179,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line222">line 222</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line227">line 227</a>
</li></ul></dd>
@ -1350,7 +1350,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line312">line 312</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line317">line 317</a>
</li></ul></dd>
@ -1452,7 +1452,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line60">line 60</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line65">line 65</a>
</li></ul></dd>
@ -1558,7 +1558,7 @@ like <a href="Parser.html#parseBrowser">Parser#parseBrowser</a> or <a href="Pars
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line422">line 422</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line427">line 427</a>
</li></ul></dd>
@ -1710,7 +1710,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line299">line 299</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line304">line 304</a>
</li></ul></dd>
@ -1794,7 +1794,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line77">line 77</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line82">line 82</a>
</li></ul></dd>
@ -1896,7 +1896,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line274">line 274</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line279">line 279</a>
</li></ul></dd>
@ -1998,7 +1998,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line160">line 160</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line165">line 165</a>
</li></ul></dd>
@ -2103,7 +2103,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line236">line 236</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line241">line 241</a>
</li></ul></dd>
@ -2205,7 +2205,7 @@ the OS called &quot;anything&quot; or the platform called &quot;anything&quot;</
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line335">line 335</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line340">line 340</a>
</li></ul></dd>
@ -2376,7 +2376,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line69">line 69</a>
<a href="parser.js.html">parser.js</a>, <a href="parser.js.html#line74">line 74</a>
</li></ul></dd>
@ -2528,7 +2528,7 @@ Returns <code>undefined</code> when the browser is no described in the checkTree
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:09:12 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:30:49 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

@ -96,7 +96,7 @@ export default Bowser;
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:09:12 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:30:48 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

@ -238,6 +238,9 @@
<span class="param-type">String</span>
|
<span class="param-type">undefined</span>
@ -255,7 +258,7 @@
<td class="description last"></td>
<td class="description last"><p>Browser name, like <code>&quot;Chrome&quot;</code> or <code>&quot;Internet Explorer&quot;</code></p></td>
</tr>
@ -269,6 +272,9 @@
<span class="param-type">String</span>
|
<span class="param-type">undefined</span>
@ -286,7 +292,7 @@
<td class="description last"></td>
<td class="description last"><p>Browser version as a String <code>&quot;12.01.45334.10&quot;</code></p></td>
</tr>
@ -350,6 +356,9 @@
<span class="param-type">String</span>
|
<span class="param-type">undefined</span>
@ -367,7 +376,7 @@
<td class="description last"></td>
<td class="description last"><p>OS name, like <code>&quot;Windows&quot;</code> or <code>&quot;macOS&quot;</code></p></td>
</tr>
@ -381,6 +390,9 @@
<span class="param-type">String</span>
|
<span class="param-type">undefined</span>
@ -398,7 +410,7 @@
<td class="description last"></td>
<td class="description last"><p>OS version, like <code>&quot;NT 5.1&quot;</code> or <code>&quot;10.11.1&quot;</code></p></td>
</tr>
@ -412,6 +424,9 @@
<span class="param-type">String</span>
|
<span class="param-type">undefined</span>
@ -429,7 +444,7 @@
<td class="description last"></td>
<td class="description last"><p>OS name, like <code>&quot;XP&quot;</code> or <code>&quot;High Sierra&quot;</code></p></td>
</tr>
@ -493,6 +508,9 @@
<span class="param-type">String</span>
|
<span class="param-type">undefined</span>
@ -510,7 +528,7 @@
<td class="description last"></td>
<td class="description last"><p>platform type, can be either <code>&quot;desktop&quot;</code>, <code>&quot;tablet&quot;</code> or <code>&quot;mobile&quot;</code></p></td>
</tr>
@ -524,6 +542,9 @@
<span class="param-type">String</span>
|
<span class="param-type">undefined</span>
@ -541,7 +562,8 @@
<td class="description last"></td>
<td class="description last"><p>Vendor of the device,
like <code>&quot;Apple&quot;</code> or <code>&quot;Samsung&quot;</code></p></td>
</tr>
@ -555,6 +577,9 @@
<span class="param-type">String</span>
|
<span class="param-type">undefined</span>
@ -572,7 +597,8 @@
<td class="description last"></td>
<td class="description last"><p>Device model,
like <code>&quot;iPhone&quot;</code> or <code>&quot;Kindle Fire HD 7&quot;</code></p></td>
</tr>
@ -636,6 +662,9 @@
<span class="param-type">String</span>
|
<span class="param-type">undefined</span>
@ -653,7 +682,7 @@
<td class="description last"></td>
<td class="description last"><p>Can be any of this: <code>WebKit</code>, <code>Blink</code>, <code>Gecko</code>, <code>Trident</code>, <code>Presto</code>, <code>EdgeHTML</code></p></td>
</tr>
@ -667,6 +696,9 @@
<span class="param-type">String</span>
|
<span class="param-type">undefined</span>
@ -684,7 +716,7 @@
<td class="description last"></td>
<td class="description last"><p>String version of the engine</p></td>
</tr>
@ -726,7 +758,7 @@
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:09:12 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:30:49 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

@ -113,7 +113,7 @@ const isValidBrowser = bowser.compare({
chrome: &quot;>20.1.1432&quot;,
firefox: &quot;>31&quot;,
opera: &quot;>22&quot;
});</code></pre><p>As you can see, settings for any particular OS has more priority and redefines settings of <code>any</code> property.</p>
});</code></pre><p>Settings for any particular OS has more priority and redefines settings of standalone browsers.</p>
<h3>new Bowser(<code>:Object</code>)</h3><p>Use it to get object with detected flags of your current browser.</p>
<h3>bowser._detect(ua <code>:String</code>)<code>:Object</code></h3><p>Use it to get object with detected flags from User Agent string.</p>
<h3>bowser.check(minVersions<code>:Object</code>, strictMode<code>:Boolean</code>, [ua]<code>:String</code>)<code>:Boolean</code></h3><p>Use it to check if browser is supported. In default non-strict mode any browser family not present in <code>minVersions</code> will pass the check (like Chrome in the third call in the sample bellow). When strict mode is enabled then any not specified browser family in <code>minVersions</code> will cause <code>check</code> to return <code>false</code> (in the sample it is the fourth call, the last one).</p>
@ -145,13 +145,6 @@ bowser.check({chrome: &quot;45&quot;}, true, window.navigator.userAgent); // fal
</ul>
<p>For unknown browsers, Bowser makes a best guess from the UA string. So, these may not be set.</p>
<h3>Rendering engine flags</h3><p>If detected, one of these flags may be set to true:</p>
<ul>
<li><code>webkit</code> - Chrome 0-27, Android &lt;4.4, iOs, BB, etc.</li>
<li><code>blink</code> - Chrome &gt;=28, Android &gt;=4.4, Opera, etc.</li>
<li><code>gecko</code> - Firefox, etc.</li>
<li><code>msie</code> - IE &lt;= 11</li>
<li><code>msedge</code> - IE &gt; 11</li>
</ul>
<p>Safari, Chrome and some other minor browsers will report that they have <code>webkit</code> engines.
Firefox and Seamonkey will report that they have <code>gecko</code> engines.</p>
<pre class="prettyprint source lang-js"><code>if (bowser.webkit) {
@ -243,7 +236,7 @@ check if all tests are still passing.</p>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:09:12 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:30:49 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

@ -69,19 +69,24 @@ class Parser {
/**
* @typedef ParsedResult
* @property {Object} browser
* @property {String} [browser.name]
* @property {String} [browser.version]
* @property {String|undefined} [browser.name]
* Browser name, like `"Chrome"` or `"Internet Explorer"`
* @property {String|undefined} [browser.version] Browser version as a String `"12.01.45334.10"`
* @property {Object} os
* @property {String} [os.name]
* @property {String} [os.version]
* @property {String} [os.versionName]
* @property {String|undefined} [os.name] OS name, like `"Windows"` or `"macOS"`
* @property {String|undefined} [os.version] OS version, like `"NT 5.1"` or `"10.11.1"`
* @property {String|undefined} [os.versionName] OS name, like `"XP"` or `"High Sierra"`
* @property {Object} platform
* @property {String} [platform.type]
* @property {String} [platform.vendor]
* @property {String} [platform.model]
* @property {String|undefined} [platform.type]
* platform type, can be either `"desktop"`, `"tablet"` or `"mobile"`
* @property {String|undefined} [platform.vendor] Vendor of the device,
* like `"Apple"` or `"Samsung"`
* @property {String|undefined} [platform.model] Device model,
* like `"iPhone"` or `"Kindle Fire HD 7"`
* @property {Object} engine
* @property {String} [engine.name]
* @property {String} [engine.version]
* @property {String|undefined} [engine.name]
* Can be any of this: `WebKit`, `Blink`, `Gecko`, `Trident`, `Presto`, `EdgeHTML`
* @property {String|undefined} [engine.version] String version of the engine
*/
this.parsedResult = {};
@ -476,7 +481,7 @@ export default Parser;
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:09:12 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:30:48 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

@ -186,7 +186,7 @@ module.exports = Utils;
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:09:12 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Sun Jul 08 2018 12:30:48 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
</footer>
<script>prettyPrint();</script>

@ -30,19 +30,24 @@ class Parser {
/**
* @typedef ParsedResult
* @property {Object} browser
* @property {String} [browser.name]
* @property {String} [browser.version]
* @property {String|undefined} [browser.name]
* Browser name, like `"Chrome"` or `"Internet Explorer"`
* @property {String|undefined} [browser.version] Browser version as a String `"12.01.45334.10"`
* @property {Object} os
* @property {String} [os.name]
* @property {String} [os.version]
* @property {String} [os.versionName]
* @property {String|undefined} [os.name] OS name, like `"Windows"` or `"macOS"`
* @property {String|undefined} [os.version] OS version, like `"NT 5.1"` or `"10.11.1"`
* @property {String|undefined} [os.versionName] OS name, like `"XP"` or `"High Sierra"`
* @property {Object} platform
* @property {String} [platform.type]
* @property {String} [platform.vendor]
* @property {String} [platform.model]
* @property {String|undefined} [platform.type]
* platform type, can be either `"desktop"`, `"tablet"` or `"mobile"`
* @property {String|undefined} [platform.vendor] Vendor of the device,
* like `"Apple"` or `"Samsung"`
* @property {String|undefined} [platform.model] Device model,
* like `"iPhone"` or `"Kindle Fire HD 7"`
* @property {Object} engine
* @property {String} [engine.name]
* @property {String} [engine.version]
* @property {String|undefined} [engine.name]
* Can be any of this: `WebKit`, `Blink`, `Gecko`, `Trident`, `Presto`, `EdgeHTML`
* @property {String|undefined} [engine.version] String version of the engine
*/
this.parsedResult = {};

Loading…
Cancel
Save