refactor(script): remove loadScript & loadStyle

This commit is contained in:
Jimmy Cai 2020-12-22 19:17:12 +01:00
parent 619998b2f3
commit 69cd9343a0
No known key found for this signature in database
GPG Key ID: 3EA408E527F37B18
2 changed files with 0 additions and 45 deletions

View File

@ -1,5 +1,3 @@
import { loadScript, loadStyle } from 'ts/utils';
declare global {
interface Window {
PhotoSwipe: any;

View File

@ -1,43 +0,0 @@
/**
* Load script asynchronous
* @return {Promise}
* @param url
*/
const loadScript = function (url) {
return new Promise(resolve => {
var scriptTag = document.createElement('script');
scriptTag.src = url;
scriptTag.onload = () => {
resolve();
};
document.head.appendChild(scriptTag);
})
};
/**
* Load style asynchronous
* @return {Promise}
* @param url
*/
const loadStyle = function (url) {
return new Promise(resolve => {
var link = document.createElement('link');
link.href = url;
link.type = "text/css";
link.rel = "stylesheet";
link.onload = () => {
resolve();
};
document.head.appendChild(link);
});
};
export {
loadScript,
loadStyle
}