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

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

{
  "version": 3,
  "sources": ["../../../src/util/createLinkInHead.ts"],
  "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"],
  "mappings": "aAKA,MAAMA,EAAmB,CAACC,EAAcC,IAAwC,CAC/E,MAAMC,EAAO,SAAS,cAAc,MAAM,EAC1C,OAAAA,EAAK,KAAO,WACZA,EAAK,IAAM,aAEPD,GACH,OAAO,QAAQA,CAAU,EAAE,QAAQE,GAAQD,EAAK,aAAa,GAAGC,CAAI,CAAC,EAGtED,EAAK,KAAOF,EAEZ,SAAS,KAAK,YAAYE,CAAI,EAEvB,IAAI,QAAeE,GAAW,CACpCF,EAAK,iBAAiB,OAAQE,CAAO,EACrCF,EAAK,iBAAiB,QAASE,CAAO,CACvC,CAAC,CACF,EAEA,eAAeL",
  "names": ["createLinkInHead", "href", "attributes", "link", "pair", "resolve"]
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy