Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
{
"version": 3,
"sources": ["../../../src/util/getSingletonElementInstance.ts"],
"sourcesContent": ["/**\n * Returns a singleton HTML element, inserted in given parent element of HTML page,\n * used mostly to store and share global resources between multiple UI5 Web Components runtimes.\n *\n * @param { string } tag the element tag/selector\n * @param { HTMLElement } parentElement the parent element to insert the singleton element instance\n * @param { Function } createEl a factory function for the element instantiation, by default document.createElement is used\n * @returns { Element }\n */\nconst getSingletonElementInstance = (tag: string, parentElement: HTMLElement = document.body, createEl?: () => Element) => {\n\tlet el = document.querySelector(tag);\n\n\tif (el) {\n\t\treturn el;\n\t}\n\n\tel = createEl ? createEl() : document.createElement(tag);\n\n\treturn parentElement.insertBefore(el, parentElement.firstChild);\n};\n\nexport default getSingletonElementInstance;\n"],
"mappings": "aASA,MAAMA,EAA8B,CAACC,EAAaC,EAA6B,SAAS,KAAMC,IAA6B,CAC1H,IAAIC,EAAK,SAAS,cAAcH,CAAG,EAEnC,OAAIG,IAIJA,EAAKD,EAAWA,EAAS,EAAI,SAAS,cAAcF,CAAG,EAEhDC,EAAc,aAAaE,EAAIF,EAAc,UAAU,EAC/D,EAEA,eAAeF",
"names": ["getSingletonElementInstance", "tag", "parentElement", "createEl", "el"]
}