All Downloads are FREE. Search and download functionalities are using the official Maven repository.

package.dist.util.getSingletonElementInstance.js.map Maven / Gradle / Ivy

{"version":3,"file":"getSingletonElementInstance.js","sourceRoot":"","sources":["../../src/util/getSingletonElementInstance.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,MAAM,2BAA2B,GAAG,CAAC,GAAW,EAAE,gBAA6B,QAAQ,CAAC,IAAI,EAAE,QAAwB,EAAE,EAAE;IACzH,IAAI,EAAE,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAErC,IAAI,EAAE,EAAE;QACP,OAAO,EAAE,CAAC;KACV;IAED,EAAE,GAAG,QAAQ,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAEzD,OAAO,aAAa,CAAC,YAAY,CAAC,EAAE,EAAE,aAAa,CAAC,UAAU,CAAC,CAAC;AACjE,CAAC,CAAC;AAEF,eAAe,2BAA2B,CAAC","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"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy