package.lib.utils.userAgent.js.flow Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of core Show documentation
Show all versions of core Show documentation
Tooltip and Popover Positioning Engine
// @flow
type Navigator = Navigator & { userAgentData?: NavigatorUAData };
interface NavigatorUAData {
brands: Array<{ brand: string, version: string }>;
mobile: boolean;
platform: string;
}
export default function getUAString(): string {
const uaData = (navigator: Navigator).userAgentData;
if (uaData?.brands) {
return uaData.brands
.map((item) => `${item.brand}/${item.version}`)
.join(' ');
}
return navigator.userAgent;
}