import { createBrowserHistory as createHistory } from 'history';
import EnvManage from './Env';
import CacheManage from './Cache';
import ApiManage from './Api';

export const Env = new EnvManage();

export const Cache = new CacheManage();

export const Api = new ApiManage();

export const History = createHistory({ basename: __BASE_NAME__ });

window.linkTo = link => {
  /**
   * 跳转页面
   */
  History.push(link);
};
window.replaceLink = link => {
  /**
   * 刷新当前页
   */
  History.replace(link);
};
window.goBack = () => {
  /**
   * 返回上一页
   */
  History.goBack();
};
window.toLink = link => {
  /**
   * 跳转页面
   */
  window.location.href = link;
};
window.openLink = link => {
  /**
   * 打开新页面
   */
  window.open(link);
};
