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

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

{"version":3,"file":"createLinkInHead.js","sourceRoot":"","sources":["../../src/util/createLinkInHead.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,CAAC,IAAY,EAAE,UAAmC,EAAE,EAAE;IAC9E,MAAM,IAAI,GAAG,QAAQ,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAC5C,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;IACvB,IAAI,CAAC,GAAG,GAAG,YAAY,CAAC;IAExB,IAAI,UAAU,EAAE;QACf,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;KACvE;IAED,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IAEjB,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAEhC,OAAO,IAAI,OAAO,CAAQ,OAAO,CAAC,EAAE;QACnC,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;QACvC,IAAI,CAAC,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,WAAW;IACrD,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["/**\n * Creates a `` tag in the `` tag\n * @param href - the CSS\n * @param attributes - optional attributes to add to the tag\n */\nconst createLinkInHead = (href: string, attributes?: Record) => {\n\tconst link = document.createElement(\"link\");\n\tlink.type = \"text/css\";\n\tlink.rel = \"stylesheet\";\n\n\tif (attributes) {\n\t\tObject.entries(attributes).forEach(pair => link.setAttribute(...pair));\n\t}\n\n\tlink.href = href;\n\n\tdocument.head.appendChild(link);\n\n\treturn new Promise(resolve => {\n\t\tlink.addEventListener(\"load\", resolve);\n\t\tlink.addEventListener(\"error\", resolve); // intended\n\t});\n};\n\nexport default createLinkInHead;\n"]}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy