Skip to content

Commit 4e24294

Browse files
authored
Merge pull request #3 from Foorack/copilot/add-jsdoc-for-window-close-function
Add JSDoc documentation to shouldPreventWindowClose method
2 parents 0dd95a4 + 6fa5d69 commit 4e24294

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/client/ClientGameRunner.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,16 @@ export class ClientGameRunner {
225225
this.lastMessageTime = Date.now();
226226
}
227227

228+
/**
229+
* Determines whether window closing should be prevented.
230+
*
231+
* Used to show a confirmation dialog when the user attempts to close
232+
* the window or navigate away during an active game session.
233+
*
234+
* @returns {boolean} `true` if the window close should be prevented
235+
* (when the player is alive in the game), `false` otherwise
236+
* (when the player is not alive or doesn't exist)
237+
*/
228238
public shouldPreventWindowClose(): boolean {
229239
// Show confirmation dialog if player is alive in the game
230240
if (this.myPlayer && this.myPlayer.isAlive()) {

0 commit comments

Comments
 (0)