Skip to content

Commit

Permalink
fix: pause game if hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
7underlines committed Oct 8, 2024
1 parent 4ffa9ee commit fc5f762
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ If you encounter any issues or have any questions or suggestions, please open an

## Recent Changelog

- v2.3: Pause game if hidden
- v2.2: Fixed JavaScript music errors
- v2.1: Stop bgm if the game is not visible
- v2.1: Show the value of an upgrade, thanks [@Taklaminon](https://github.com/redpangilinan/dungeon-crawler-rpg-od/issues/3)
Expand Down
10 changes: 10 additions & 0 deletions www/assets/js/combat.js
Original file line number Diff line number Diff line change
Expand Up @@ -385,3 +385,13 @@ const showCombatInfo = () => {
</div>
`;
}

document.addEventListener("visibilitychange", () => {
if (!player.inCombat) {
return
}
if (document.hidden) {
alert("Paused")
}
});

0 comments on commit fc5f762

Please sign in to comment.