/**
 * 动态加载script
 * @param {string} url 
 * @param {Function} callback 
 */
 export function loadScript(url, callback) {
    let script = document.createElement("script");
    // @ts-ignore
    if (script.readyState) {
      // IE
      // @ts-ignore
      script.onreadystatechange = function () {
        if (
          // @ts-ignore
          script.readyState === "loaded" ||
          // @ts-ignore
          script.readyState === "complete"
        ) {
          // @ts-ignore
          script.onreadystatechange = null;
          callback();
        }
      };
    } else {
      // 其他浏览器
      script.onload = function () {
        callback();
      };
    }
    script.src = url;
    document.getElementsByTagName("head")[0].appendChild(script);
  }