19lmyers / cse110-w21-group14

1 stars 2 forks source link

Implement page warning confirmation #57

Closed j1sun closed 3 years ago

j1sun commented 3 years ago

Implement a warning right before the user closes the window (eg. Are you sure you want to leave this page?) so that the user doesn't accidentally close the tab unexpectedly.

There's likely a way to alert or ask for confirmation from the user in the same style as alert() (don't make new HTML elements, just use what's built-in to JS).

j1sun commented 3 years ago

One interesting way to implement this is on top of localStorage instead of giving a warning every time: Either save the current state of the timer to local storage when the window is closed and resume when they get back, or assume leaving means quitting the pomodoro early and thus doesn't count.