Skip to content

Commit

Permalink
Implement reset button. This suffices to complete assignment D3.d req…
Browse files Browse the repository at this point in the history
…uirements.
  • Loading branch information
blujai831 committed Nov 14, 2024
1 parent 8e622a4 commit 5582180
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ function makeAppUIIn(state: AppState, uiOut: AppUIOut): AppUIIn {
0,
-1,
);
result.resetButton.onclick = resetLocalStorage;
return result;
}

Expand Down Expand Up @@ -771,6 +772,13 @@ function loadStateFromLocalStorage(state: AppState, uiOut: AppUIOut): boolean {
}
}

function resetLocalStorage() {
if (confirm("Really erase all stored data associated with this web app?")) {
localStorage.clear();
location.reload();
}
}

// Init

const uiOut = makeAppUIOut();
Expand Down

0 comments on commit 5582180

Please sign in to comment.