UNPKG

@communities-webruntime/services

Version:

If you would like to run Lightning Web Runtime without the CLI, we expose some of our programmatic APIs available in Node.js. If you're looking for the CLI documentation [you can find that here](https://www.npmjs.com/package/@communities-webruntime/cli).

30 lines 1.16 kB
"use strict"; /** * Copyright (c) 2020, salesforce.com, inc. * All rights reserved. * SPDX-License-Identifier: MIT * For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/MIT */ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.ClientService = void 0; const ua_parser_js_1 = __importDefault(require("ua-parser-js")); function getFormFactor(userAgentString) { var _a; const ua = ua_parser_js_1.default(userAgentString); const deviceType = (_a = ua === null || ua === void 0 ? void 0 : ua.device) === null || _a === void 0 ? void 0 : _a.type; switch (deviceType) { case ua_parser_js_1.default.DEVICE.TABLET: return 'Medium'; case ua_parser_js_1.default.DEVICE.MOBILE: return 'Small'; default: return 'Large'; // for empty type and device types that we do not support, return Large } } exports.ClientService = { getFormFactor, }; //# sourceMappingURL=client-service.js.map