Please wait. This can take some minutes ...
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.
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"]
}