mirror of
https://github.com/lancedikson/bowser
synced 2024-10-27 20:34:22 +00:00
106 lines
4.3 KiB
HTML
106 lines
4.3 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en">
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<title>bowser.js - Documentation</title>
|
||
|
|
||
|
<script src="scripts/prettify/prettify.js"></script>
|
||
|
<script src="scripts/prettify/lang-css.js"></script>
|
||
|
<!--[if lt IE 9]>
|
||
|
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||
|
<![endif]-->
|
||
|
<link type="text/css" rel="stylesheet" href="styles/prettify.css">
|
||
|
<link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
|
||
|
</head>
|
||
|
<body>
|
||
|
|
||
|
<input type="checkbox" id="nav-trigger" class="nav-trigger" />
|
||
|
<label for="nav-trigger" class="navicon-button x">
|
||
|
<div class="navicon"></div>
|
||
|
</label>
|
||
|
|
||
|
<label for="nav-trigger" class="overlay"></label>
|
||
|
|
||
|
<nav>
|
||
|
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Bowser.html">Bowser</a><ul class='methods'><li data-type='method'><a href="Bowser.html#.getParser">getParser</a></li><li data-type='method'><a href="Bowser.html#.parse">parse</a></li></ul></li><li><a href="Parser.html">Parser</a><ul class='methods'><li data-type='method'><a href="Parser.html#compare">compare</a></li><li data-type='method'><a href="Parser.html#getBrowser">getBrowser</a></li><li data-type='method'><a href="Parser.html#getBrowserName">getBrowserName</a></li><li data-type='method'><a href="Parser.html#getBrowserVersion">getBrowserVersion</a></li><li data-type='method'><a href="Parser.html#getEngine">getEngine</a></li><li data-type='method'><a href="Parser.html#getOS">getOS</a></li><li data-type='method'><a href="Parser.html#getOSName">getOSName</a></li><li data-type='method'><a href="Parser.html#getOSVersion">getOSVersion</a></li><li data-type='method'><a href="Parser.html#getPlatform">getPlatform</a></li><li data-type='method'><a href="Parser.html#getPlatformType">getPlatformType</a></li><li data-type='method'><a href="Parser.html#getResult">getResult</a></li><li data-type='method'><a href="Parser.html#getUA">getUA</a></li><li data-type='method'><a href="Parser.html#is">is</a></li><li data-type='method'><a href="Parser.html#parse">parse</a></li><li data-type='method'><a href="Parser.html#parseBrowser">parseBrowser</a></li><li data-type='method'><a href="Parser.html#parseEngine">parseEngine</a></li><li data-type='method'><a href="Parser.html#parseOS">parseOS</a></li><li data-type='method'><a href="Parser.html#parsePlatform">parsePlatform</a></li><li data-type='method'><a href="Parser.html#test">test</a></li></ul></li></ul><h3><a href="global.html">Global</a></h3>
|
||
|
</nav>
|
||
|
|
||
|
<div id="main">
|
||
|
|
||
|
<h1 class="page-title">bowser.js</h1>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<section>
|
||
|
<article>
|
||
|
<pre class="prettyprint source linenums"><code>/*!
|
||
|
* Bowser - a browser detector
|
||
|
* https://github.com/lancedikson/bowser
|
||
|
* MIT License | (c) Dustin Diaz 2012-2015
|
||
|
* MIT License | (c) Denis Demchenko 2015-2017
|
||
|
*/
|
||
|
import Parser from './parser';
|
||
|
|
||
|
/**
|
||
|
* Bowser class.
|
||
|
* Keep it simple as much as it can be.
|
||
|
* It's supposed to work with collections of {@link Parser} instances
|
||
|
* rather then solve one-instance problems.
|
||
|
* All the one-instance stuff is located in Parser class.
|
||
|
*/
|
||
|
class Bowser {
|
||
|
/**
|
||
|
* Creates a {@link module:parser:Parser} instance
|
||
|
*
|
||
|
* @param {String} UA UserAgent string
|
||
|
* @param {Boolean} [skipParsing=false] same as skipParsing for {@link Parser}
|
||
|
* @returns {Parser}
|
||
|
* @throws {Error} when UA is not a String
|
||
|
*
|
||
|
* @example
|
||
|
* const bowser = new Bowser(window.navigator.userAgent);
|
||
|
* bowser.getResult()
|
||
|
*/
|
||
|
static getParser(UA, skipParsing=false) {
|
||
|
if (typeof UA !== 'string') {
|
||
|
throw new Error('UserAgent should be a string');
|
||
|
}
|
||
|
return new Parser(UA, skipParsing);
|
||
|
}
|
||
|
|
||
|
/**
|
||
|
* Creates a {@link Parser} instance and runs {@link Parser.getResult} immediately
|
||
|
*
|
||
|
* @param UA
|
||
|
* @return {ParsedResult}
|
||
|
*/
|
||
|
static parse(UA) {
|
||
|
return (new Bowser(UA)).getResult();
|
||
|
}
|
||
|
}
|
||
|
|
||
|
export default Bowser;
|
||
|
</code></pre>
|
||
|
</article>
|
||
|
</section>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</div>
|
||
|
|
||
|
<br class="clear">
|
||
|
|
||
|
<footer>
|
||
|
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> on Thu Jul 05 2018 22:44:07 GMT+0300 (EEST) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
||
|
</footer>
|
||
|
|
||
|
<script>prettyPrint();</script>
|
||
|
<script src="scripts/linenumber.js"></script>
|
||
|
</body>
|
||
|
</html>
|