@mongodb-js/mongodb-ui-components
Version:
A collection of frequently used functional UI components found on mongodb properties
22 lines (17 loc) • 428 B
JavaScript
;
module.exports = style;
function style(type, url) {
const script = document.createElement(type);
if (type === 'link') {
script.rel = 'stylesheet';
script.href = url;
} else if (type === 'script') {
script.async = true;
script.src = url;
}
document.head.appendChild(script);
return new Promise((resolve, reject) => {
script.onload = resolve;
script.onerror = reject;
});
}