Skip to content

Commit

Permalink
👌 add some more
Browse files Browse the repository at this point in the history
  • Loading branch information
arunachalam-monk committed Jul 18, 2024
1 parent e95f7c8 commit 0e3d021
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/common/src/PreventExit/store.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
const keys: Array<symbol> = [];
const allPreventExitState: Record<symbol, boolean> = {};

function arePreventExitRemaining() {
function arePreventExitRemaining(): boolean {
if (keys.map((key) => allPreventExitState[key]).every((i) => i === false)) {
window.onbeforeunload = null;
return true;
}

return false;
}

Expand All @@ -20,7 +19,7 @@ function publish(id: symbol, preventExit: boolean): void {
}

/**
* Returns a listener which can used to calculate the state of prevent exit
* Returns a listener which can used to calculate the state of prevent exit.
*/
export interface PreventExitListenerResult {
/**
Expand Down

0 comments on commit 0e3d021

Please sign in to comment.