defer-css
Advanced tools
Comparing version 0.0.2 to 0.0.3
18
index.js
@@ -0,5 +1,12 @@ | ||
// @ts-check | ||
let deferCssData = {}; | ||
const deferCss = (links, config = 'link') => { | ||
/** | ||
* @param {object[]} links | ||
* @param {string|object} config | ||
*/ | ||
const deferCss = function (links, config) { | ||
// Setup Config default Values. | ||
if (config === undefined) config = 'link'; | ||
if (typeof config !== "object") config = {mountOn: config}; | ||
@@ -31,3 +38,3 @@ if (typeof config.name === "undefined") config.name = "default"; | ||
newLink.onload = function () { | ||
window.deferCssData[config.name].loaded++; | ||
deferCssData[config.name].loaded++; | ||
linkData.onload(linkData) | ||
@@ -38,3 +45,3 @@ } | ||
newLink.onload = function () { | ||
window.deferCssData[config.name].loaded++; | ||
deferCssData[config.name].loaded++; | ||
} | ||
@@ -53,2 +60,3 @@ } | ||
// @ts-ignore | ||
firstLink.parentNode.insertBefore(newLink, firstLink); | ||
@@ -58,3 +66,3 @@ } | ||
window.deferCss = deferCss; | ||
window.deferCssData = deferCssData; | ||
window['deferCss'] = deferCss; | ||
window['deferCssData'] = deferCssData; |
{ | ||
"name": "defer-css", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Load css in your page without affecting load speed.", | ||
"main": "index.js", | ||
"main": "index.min.js", | ||
"repository": "https://github.com/trapcodeio/defer-css.git", | ||
@@ -7,0 +7,0 @@ "author": "trapcode", |
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
52
1
8
4386
6