main
Last change
on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago |
Update repo after prototype presentation
|
-
Property mode
set to
100644
|
File size:
493 bytes
|
Line | |
---|
1 | // @flow
|
---|
2 | type Navigator = Navigator & { userAgentData?: NavigatorUAData };
|
---|
3 |
|
---|
4 | interface NavigatorUAData {
|
---|
5 | brands: Array<{ brand: string, version: string }>;
|
---|
6 | mobile: boolean;
|
---|
7 | platform: string;
|
---|
8 | }
|
---|
9 |
|
---|
10 | export default function getUAString(): string {
|
---|
11 | const uaData = (navigator: Navigator).userAgentData;
|
---|
12 |
|
---|
13 | if (uaData?.brands && Array.isArray(uaData.brands)) {
|
---|
14 | return uaData.brands
|
---|
15 | .map((item) => `${item.brand}/${item.version}`)
|
---|
16 | .join(' ');
|
---|
17 | }
|
---|
18 |
|
---|
19 | return navigator.userAgent;
|
---|
20 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.