jsdefer
jsdefer copied to clipboard
Support including css links
Add support for including css links in the loader... Just for convenience of using one thing to include everything, and it is only a few more lines of code.
Example:
loader.addCSS = function (url) {
if (loader.scripts[url] == undefined) {
loader.scripts[url] = { loaded: true, callbacks: [] };
var link = document.createElement("link");
link.setAttribute("rel", "stylesheet");
link.setAttribute("type", "text/css");
link.setAttribute("href", url);
document.getElementsByTagName("head")[0].appendChild(link);
}
};
Also, maybe add a param for adding css to top or bottom of head.
Yes we plan to include this feature in a future version