Skip to content

Commit

Permalink
feat: Confirmation before closing the tab #1
Browse files Browse the repository at this point in the history
  • Loading branch information
billchurch committed Nov 30, 2024
1 parent adeadfa commit 1ce9c13
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/public/client.htm
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!-- Version Version 0.2.25 - 2024-08-23T00:49:53.069Z - 9e6d282 -->
<!-- Version Version 0.2.25 - 2024-11-30T02:52:43.517Z - adeadfa -->
<!-- webssh2-client -->
<!-- /client/src/client.htm -->
<!DOCTYPE html>
Expand Down
12 changes: 8 additions & 4 deletions client/public/webssh2.bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/public/webssh2.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion client/src/js/dom.js
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ export function initializeElements() {

/**
* Sets up event listeners for various elements in the application.
* @param {Object} config - The configuration object containing application settings
*/
export function setupEventListeners(config) {
debug('setupEventListeners')
Expand Down Expand Up @@ -221,7 +222,10 @@ export function setupEventListeners(config) {
// Global event listeners
window.addEventListener('resize', resize)
document.addEventListener('keydown', keydown)

// Add beforeunload event listener to prevent accidental tab closure
window.addEventListener('beforeunload', (event) => {
event.preventDefault()
})
passwordInput.addEventListener('keyup', detectCapsLock)
passwordInput.addEventListener('keydown', detectCapsLock)
}
Expand Down

0 comments on commit 1ce9c13

Please sign in to comment.