Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
update: unloadCallback made private
Browse files Browse the repository at this point in the history
  • Loading branch information
yaya-usman committed Apr 20, 2022
1 parent e37af06 commit 2c9712b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/components/structures/auth/Registration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,15 @@ export default class Registration extends React.Component<IProps, IState> {

componentDidMount() {
this.replaceClient(this.props.serverConfig);
//triggers a confirmation dialog for data loss before page unloads/refreshes
window.addEventListener("beforeunload", this.unloadCallback);
}

componentWillUnmount() {
window.removeEventListener("beforeunload", this.unloadCallback);
}

unloadCallback = (event) => {
private unloadCallback = (event) => {
event.preventDefault();
event.returnValue = "";
return "";
Expand Down

0 comments on commit 2c9712b

Please sign in to comment.