17 lines
737 B
JavaScript
17 lines
737 B
JavaScript
import { getWindow } from './dom/getWindow';
|
|
var isMacResult;
|
|
/**
|
|
* Returns true if the user is on a Mac. Caches the result value.
|
|
* @param reset - Reset the cached result value (mainly for testing).
|
|
*/
|
|
export function isMac(reset) {
|
|
var _a;
|
|
if (typeof isMacResult === 'undefined' || reset) {
|
|
var win = getWindow();
|
|
// In certain SSR frameworks, `window` will be defined even on the server but `navigator` will be undefined
|
|
var userAgent = (_a = win === null || win === void 0 ? void 0 : win.navigator) === null || _a === void 0 ? void 0 : _a.userAgent;
|
|
isMacResult = !!userAgent && userAgent.indexOf('Macintosh') !== -1;
|
|
}
|
|
return !!isMacResult;
|
|
}
|
|
//# sourceMappingURL=osDetector.js.map
|