This commit is contained in:
Liwanyi 2023-03-03 15:35:43 +08:00
parent 2a43fa33ab
commit ed066f8565
3 changed files with 96 additions and 52 deletions

View File

@ -16,7 +16,7 @@ let vuePath = node_env === 'production' ?
'vue/dist/vue.runtime.esm-browser.prod.js' :
'vue/dist/vue.runtime.esm-browser.js';
export default {
input: 'src/ts/class/Application.ts',
input: 'src/ts/index.ts',
output: {
file: 'dist/bundle.js',
format: 'iife',

View File

@ -1,47 +1,48 @@
import WuhuBase from "./WuhuBase";
import WuHuTornHelper from "./WuhuTornHelper";
import ZhongIcon from "./ZhongIcon";
import { Common } from "./Common";
import UrlPattern from "./UrlMatch";
import WuhuConfig from "./WuhuConfig";
import translateMain from "../func/translate/translateMain";
import CommonUtils from "./utils/CommonUtils";
import EntryPoint from "./provider/EntryPoint";
@EntryPoint
export default class Application {
public static main(): void {
WuhuBase.conditionInterrupt();
// 初始化
WuHuTornHelper.getInstance().init();
// 插件设置默认值
WuhuConfig.setDefaults();
// 插件图标和设置菜单
ZhongIcon.getInstance().init();
let tmp = () => {
// 所有页面通用
try {
Common.getInstance().resolve(Application.main);
} catch (e) {
// if (e.message === '重载') Common.getInstance().resolve(null);
}
// URL匹配
UrlPattern.getInstance().resolve();
// 翻译
if (WuhuConfig.get('transEnable')) translateMain(window.location.href);
};
// TODO 临时检测jquery
if (typeof $ === "function") {
tmp();
} else {
CommonUtils.getInstance().jQueryReady().then(() => tmp());
}
}
}
// import WuhuBase from "./WuhuBase";
// import WuHuTornHelper from "./WuhuTornHelper";
// import ZhongIcon from "./ZhongIcon";
// import { Common } from "./Common";
// import UrlPattern from "./UrlMatch";
// import WuhuConfig from "./WuhuConfig";
// import translateMain from "../func/translate/translateMain";
// import CommonUtils from "./utils/CommonUtils";
// import EntryPoint from "./provider/EntryPoint";
//
// @EntryPoint
// export default class Application {
//
// public static main(): void {
// WuhuBase.conditionInterrupt();
//
// // 初始化
// WuHuTornHelper.getInstance().init();
//
// // 插件设置默认值
// WuhuConfig.setDefaults();
//
// // 插件图标和设置菜单
// ZhongIcon.getInstance().init();
//
// let tmp = () => {
// // 所有页面通用
// try {
// Common.getInstance().resolve(Application.main);
// } catch (e) {
// // if (e.message === '重载') Common.getInstance().resolve(null);
// }
//
// // URL匹配
// UrlPattern.getInstance().resolve();
//
// // 翻译
// if (WuhuConfig.get('transEnable')) translateMain(window.location.href);
// };
// // TODO 临时检测jquery
// if (typeof $ === "function") {
// tmp();
// } else {
// CommonUtils.getInstance().jQueryReady().then(() => tmp());
// }
// }
// }
export default {}

View File

@ -1,4 +1,47 @@
// import Starter from "./class/provider/Starter";
// import Application from "./class/Application";
//
// Starter.run(Application);
import WuhuBase from "./class/WuhuBase";
import WuHuTornHelper from "./class/WuhuTornHelper";
import ZhongIcon from "./class/ZhongIcon";
import { Common } from "./class/Common";
import UrlPattern from "./class/UrlMatch";
import WuhuConfig from "./class/WuhuConfig";
import translateMain from "./func/translate/translateMain";
import CommonUtils from "./class/utils/CommonUtils";
import EntryPoint from "./class/provider/EntryPoint";
@EntryPoint
export default class Application {
public static main(): void {
WuhuBase.conditionInterrupt();
// 初始化
WuHuTornHelper.getInstance().init();
// 插件设置默认值
WuhuConfig.setDefaults();
// 插件图标和设置菜单
ZhongIcon.getInstance().init();
let tmp = () => {
// 所有页面通用
try {
Common.getInstance().resolve(Application.main);
} catch (e) {
// if (e.message === '重载') Common.getInstance().resolve(null);
}
// URL匹配
UrlPattern.getInstance().resolve();
// 翻译
if (WuhuConfig.get('transEnable')) translateMain(window.location.href);
};
// TODO 临时检测jquery
if (typeof $ === "function") {
tmp();
} else {
CommonUtils.getInstance().jQueryReady().then(() => tmp());
}
}
}