Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The timing is not accurate when the page is in the background #1

Open
haydenull opened this issue Jun 23, 2022 · 3 comments
Open

The timing is not accurate when the page is in the background #1

haydenull opened this issue Jun 23, 2022 · 3 comments

Comments

@haydenull
Copy link

haydenull commented Jun 23, 2022

Thanks to this wonderful tool, I recently discovered a small problem

  1. open https://kacgrzes.github.io/use-pomodoro/ with Chrome
  2. click the start button
  3. Use my phone's timer while switching to another TAB
  4. Back to Pomodoro after ten minutes
  5. The pomodoro has gone by five minutes and 15 seconds

I think this is probably because setInterval may be interrupted when the page � is inactive,Maybe we could use a timestamp comparison to keep track of how much time has passed。

@kacgrzes
Copy link
Owner

kacgrzes commented Jun 23, 2022

Hello @haydenull you are right, I have also noticed that recently. Do you have any idea on how to resolve this issue? I will try to work on it.

@haydenull
Copy link
Author

Hello, I have submitted a pr. Maybe can help with this. Please let me know if you have any questions.

#2.

@christianhubbard
Copy link

I'm using this in a project and noticing this as well. Any chance this gets fixed? Happy to help.

I think the 'setInterval' function in javascript should be used to run the timer, instead of a useEffect in the useInterval hook

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants