var globalCfg = window.VtxPublicServiceAddress || {};
var configUrl = {
  ztreeServer: globalCfg.ztreeServer ? globalCfg.ztreeServer : '//vortexplugin.cloudhw.cn/ztree',
  jqueryScriptUrl: globalCfg.jqueryScriptUrl ? globalCfg.jqueryScriptUrl : "https://vortexplugin.cloudhw.cn/jquery/jquery.min.js"
};
export function loadScript(url, callback) {
  var script = document.createElement('script');
  script.type = 'text/javascript';
  if (script.readyState) {
    //IE
    script.onreadystatechange = function () {
      if (script.readyState == 'loaded' || script.readyState == 'complete') {
        script.onreadystatechange = null;
        callback && callback();
      }
    };
  } else {
    //Others
    script.onload = function () {
      callback();
    };
  }
  script.src = url;
  document.body.appendChild(script);
}
export function ensurejQuery() {
  return new Promise(function (resolve) {
    if (window.$) {
      resolve();
    } else {
      loadScript(configUrl.jqueryScriptUrl, resolve);
    }
  });
}
export default configUrl;