Skip to content

Commit

Permalink
fix: prevent form from submit and reload page
Browse files Browse the repository at this point in the history
  • Loading branch information
isqua committed Jun 1, 2024
1 parent b4bcd0d commit a09d09c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ export class SettingsManager {
}

this.downloadButton = downloadButton;

this.form.addEventListener("submit", (event) => event.preventDefault());
}

onSettingsChange(callback: SettingsChangeHandler) {
Expand All @@ -69,7 +71,8 @@ export class SettingsManager {
}

onDownload(callback: () => void) {
this.downloadButton.addEventListener("click", callback);
this.downloadButton.addEventListener("click", () => callback());
this.form.addEventListener("submit", () => callback());
}

get theme() {
Expand Down

0 comments on commit a09d09c

Please sign in to comment.