@zextras/carbonio-shell-ui
Version:
The Zextras Carbonio web client
35 lines • 1.3 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getCurrentLocationHost = void 0;
exports.setGlobalCursor = setGlobalCursor;
exports.setElementSizeAndPosition = setElementSizeAndPosition;
exports.createExportForTestOnly = createExportForTestOnly;
const lodash_1 = require("lodash");
function setGlobalCursor(cursor) {
// remove previously set cursor
const cursors = [];
document.body.classList.forEach((item) => {
if (item.startsWith('global-cursor-')) {
cursors.push(item);
}
});
document.body.classList.remove(...cursors);
if (cursor) {
document.body.classList.add(`global-cursor-${cursor}`);
}
}
function setElementSizeAndPosition(element, key, value) {
// eslint-disable-next-line no-param-reassign
element.style[key] = value !== undefined ? `${value}px` : '';
}
function createExportForTestOnly(objToExport) {
return process.env.NODE_ENV === 'test'
? objToExport
: (0, lodash_1.reduce)(objToExport, (accumulator, _value, key) => {
accumulator[key] = undefined;
return accumulator;
}, {});
}
const getCurrentLocationHost = () => window.location.host;
exports.getCurrentLocationHost = getCurrentLocationHost;
//# sourceMappingURL=utils.js.map