21 lines
872 B
JavaScript
21 lines
872 B
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.isMac = void 0;
|
|
var getWindow_1 = require("./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).
|
|
*/
|
|
function isMac(reset) {
|
|
var _a;
|
|
if (typeof isMacResult === 'undefined' || reset) {
|
|
var win = (0, getWindow_1.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;
|
|
}
|
|
exports.isMac = isMac;
|
|
//# sourceMappingURL=osDetector.js.map
|