mirror of
https://github.com/VickScarlet/lifeRestart.git
synced 2026-03-30 05:58:03 +08:00
fix ios goto
This commit is contained in:
20
src/app.js
20
src/app.js
@@ -10,6 +10,25 @@ globalThis.UI =
|
||||
UIManager;
|
||||
|
||||
globalThis.$_ = utils;
|
||||
|
||||
globalThis.goto = async tag => {
|
||||
let url;
|
||||
switch(tag) {
|
||||
case 'github': url = 'https://github.com/VickScarlet/lifeRestart'; break;
|
||||
case 'discord': url = 'https://discord.gg/U3qrf49NMQ'; break;
|
||||
case 'sponsor_afd': url = 'https://afdian.net/@LifeRestart'; break;
|
||||
case 'sponsor_ddf': url = 'https://dun.mianbaoduo.com/@vickscarlet'; break;
|
||||
}
|
||||
try {
|
||||
if(Laya.Browser.onIOS) {
|
||||
window.location.href = url;
|
||||
} else {
|
||||
window.open(url, '_blank');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
class App{
|
||||
constructor(){
|
||||
this.name = 'lifeRestart';
|
||||
@@ -156,6 +175,7 @@ class App{
|
||||
dataSet=>Laya.promises.loader.load(`data/${dataSet}.json`, null, Laya.Loader.JSON),
|
||||
);
|
||||
await $ui.switchView(UI.pages.MAIN);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
15
src/index.js
15
src/index.js
@@ -1,21 +1,6 @@
|
||||
import App from './app.js';
|
||||
import Life from './modules/life.js';
|
||||
|
||||
globalThis.goto = async tag => {
|
||||
let url;
|
||||
switch(tag) {
|
||||
case 'github': url = 'https://github.com/VickScarlet/lifeRestart'; break;
|
||||
case 'discord': url = 'https://discord.gg/U3qrf49NMQ'; break;
|
||||
case 'sponsor_afd': url = 'https://afdian.net/@LifeRestart'; break;
|
||||
case 'sponsor_ddf': url = 'https://dun.mianbaoduo.com/@vickscarlet'; break;
|
||||
}
|
||||
try {
|
||||
window.open(url, '_blank');
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
globalThis.$$eventMap = new Map();
|
||||
globalThis.$$event = (tag, data) => {
|
||||
const listener = $$eventMap.get(tag);
|
||||
|
||||
Reference in New Issue
Block a user