mirror of
https://github.com/YouHaveTrouble/GuildMaster.git
synced 2026-05-12 06:26:59 +00:00
prevent phones from turning off display when the game's running
This commit is contained in:
+10
@@ -80,6 +80,7 @@ export default defineComponent({
|
|||||||
name: "GuildView",
|
name: "GuildView",
|
||||||
data: () => ({
|
data: () => ({
|
||||||
loading: true as boolean,
|
loading: true as boolean,
|
||||||
|
screenWakeLock: null as null | WakeLockSentinel,
|
||||||
guild: new Guild(1, 500),
|
guild: new Guild(1, 500),
|
||||||
gameTickTask: null as null | number,
|
gameTickTask: null as null | number,
|
||||||
gameSaveTask: null as null | number,
|
gameSaveTask: null as null | number,
|
||||||
@@ -266,6 +267,15 @@ export default defineComponent({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
async mounted() {
|
async mounted() {
|
||||||
|
|
||||||
|
setInterval(async () => {
|
||||||
|
if (this.screenWakeLock) return;
|
||||||
|
try {
|
||||||
|
this.screenWakeLock = await navigator.wakeLock.request("screen");
|
||||||
|
console.debug("Screen wake lock acquired");
|
||||||
|
} catch (e) {}
|
||||||
|
}, 1000);
|
||||||
|
|
||||||
console.debug("Loading game data")
|
console.debug("Loading game data")
|
||||||
const promises = await Promise.all([
|
const promises = await Promise.all([
|
||||||
loadAvailableQuests(),
|
loadAvailableQuests(),
|
||||||
|
|||||||
Reference in New Issue
Block a user