1
0
mirror of https://github.com/lancedikson/bowser synced 2024-10-27 20:34:22 +00:00

Add jsdoc descriptions for Parser's methods

This commit is contained in:
Denis Demchenko 2017-06-08 20:51:04 +03:00
parent 6b5974af2e
commit 5a235015aa

View File

@ -91,12 +91,29 @@ class Parser {
} }
/**
* Get browser's version
* @return {String} version of browser
*
* @public
*/
getBrowserVersion() { getBrowserVersion() {
return this.getBrowser().version; return this.getBrowser().version;
} }
getPlatform(){} getPlatform(){}
/**
* Get OS
* @return {Object}
*
* @example
* this.getOS();
* {
* name: 'macOS',
* version: '10.11.12'
* }
*/
getOS() { getOS() {
if (this.parsedResult.os) { if (this.parsedResult.os) {
return this.parsedResult.os; return this.parsedResult.os;
@ -105,6 +122,11 @@ class Parser {
return this._parseOS(); return this._parseOS();
} }
/**
* Parse OS and save it to this.parsedResult.os
* @return {*|{}}
* @private
*/
_parseOS() { _parseOS() {
this.parsedResult.os = {}; this.parsedResult.os = {};
@ -129,10 +151,18 @@ class Parser {
return this.parsedResult.os; return this.parsedResult.os;
} }
/**
* Get OS name
* @return {String} name of the OS macOS, Windows, Linux, etc.
*/
getOSName() { getOSName() {
return this.getOS().name; return this.getOS().name;
} }
/**
* Get OS version
* @return {String} full version with dots ('10.11.12', '5.6', etc)
*/
getOSVersion() { getOSVersion() {
return this.getOS().version; return this.getOS().version;
} }