Son CV dans un terminal web en Javascript! https://terminal-cv.gregandev.fr
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

34 lines
895 B

"use strict";
var cacheLoader = require('../cacheLoader');
module.exports = cacheLoader(function (bundle) {
return new Promise(function (resolve, reject) {
// Don't insert the same link element twice (e.g. if it was already in the HTML)
var existingLinks = document.getElementsByTagName('link');
if ([].concat(existingLinks).some(function isCurrentBundle(link) {
return link.href === bundle && link.rel.indexOf('stylesheet') > -1;
})) {
resolve();
return;
}
var link = document.createElement('link');
link.rel = 'stylesheet';
link.href = bundle;
link.onerror = function (e) {
link.onerror = link.onload = null;
link.remove();
reject(e);
};
link.onload = function () {
link.onerror = link.onload = null;
resolve();
};
document.getElementsByTagName('head')[0].appendChild(link);
});
});