1
0
mirror of https://github.com/lancedikson/bowser synced 2026-03-02 03:40:27 +00:00

docs: document user agent client hints addition

This commit is contained in:
Copilot
2026-02-07 17:57:02 +02:00
committed by GitHub
parent c09ff24ae1
commit fdcc87319b
9 changed files with 1723 additions and 91 deletions

View File

@@ -83,6 +83,11 @@ class Parser {
* @return {ClientHints|null}
*
* @public
* @example
* const parser = Bowser.getParser(UA, clientHints);
* const hints = parser.getHints();
* console.log(hints.platform); // 'Windows'
* console.log(hints.mobile); // false
*/
getHints() {
return this._hints;
@@ -94,6 +99,11 @@ class Parser {
* @return {boolean}
*
* @public
* @example
* const parser = Bowser.getParser(UA, clientHints);
* if (parser.hasBrand('Google Chrome')) {
* console.log('Chrome detected!');
* }
*/
hasBrand(brandName) {
if (!this._hints || !Array.isArray(this._hints.brands)) {
@@ -111,6 +121,10 @@ class Parser {
* @return {string|undefined}
*
* @public
* @example
* const parser = Bowser.getParser(UA, clientHints);
* const version = parser.getBrandVersion('Google Chrome');
* console.log(version); // '131'
*/
getBrandVersion(brandName) {
if (!this._hints || !Array.isArray(this._hints.brands)) {