package.initializers.globalProps.js Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of neeto-commons-frontend Show documentation
Show all versions of neeto-commons-frontend Show documentation
A package encapsulating common code across neeto projects including initializers, utility functions, common components and hooks and so on.
/* eslint-disable @bigbinary/neeto/no-globalProps-reassignment */
import { keysToCamelCase, deepFreezeObject, capitalize } from "@bigbinary/neeto-cist";
export default function initializeGlobalProps() {
var _document$getElements, _document$getElements2, _window, _window$globalProps;
window.globalProps = keysToCamelCase(JSON.parse(((_document$getElements = document.getElementsByClassName("root-container")[0]) === null || _document$getElements === void 0 ? void 0 : (_document$getElements2 = _document$getElements.dataset) === null || _document$getElements2 === void 0 ? void 0 : _document$getElements2.reactProps) || "{}"));
if ((_window = window) !== null && _window !== void 0 && (_window$globalProps = _window.globalProps) !== null && _window$globalProps !== void 0 && _window$globalProps.appName) {
window.globalProps.appName = capitalize(window.globalProps.appName);
}
deepFreezeObject(window.globalProps);
}
//# sourceMappingURL=globalProps.js.map