pqina / flip

⏳ The online version of the classic flip clock
https://pqina.nl/flip/
MIT License
874 stars 89 forks source link

Keep running in Background #26

Open fgarcia5 opened 3 years ago

fgarcia5 commented 3 years ago

I have a countdown running in my App and I need to send alerts at certain times regardless of whether the App is in foreground or in background.

In foreground the "onupdate" event fires correctly but in background it does not.

Here is an example of my implementation in Framework7 App and I attach an screen where it is evident that the "onupdate" is not fired when I move to background. flip-countdown

In the documentation I have not found a way to avoid this "sleep" of the timer. Could you give me any implementation or workaround suggestions?

Thanks in advance

fgarcia5 commented 3 years ago

I found a workaround. Commenting these lines: flip-countdown-workaround

And importing Tick object direcly from the file: import Tick from '@pqina/flip/tick/tick.core.module.js';

It doesn't look very fancy but it is a solution.

If there is any better solution, please let me know

rikschennink commented 2 years ago

To conserve resources the timer will pause when it's invisible, I think atm the above comment is the only way around that.