Skip to content

Commit

Permalink
Merge pull request #181 from AlecM33/close-on-unload
Browse files Browse the repository at this point in the history
manually close socket when window is unloaded
  • Loading branch information
AlecM33 committed Nov 21, 2023
2 parents 3e1a317 + 34c7a44 commit b6e22b9
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client/src/modules/page_handlers/gameHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ import { InProgress } from '../game_state/states/InProgress.js';
import { Ended } from '../game_state/states/Ended.js';

export const gameHandler = (socket, window, gameDOM) => {
window.onunload = () => {
socket.close();
};
document.body.innerHTML = gameDOM + document.body.innerHTML;
injectNavbar();
const connectionHandler = () => {
Expand Down

0 comments on commit b6e22b9

Please sign in to comment.