moribvndvs / ng2-idle

Responding to idle users in Angular (not AngularJS) applications.
https://moribvndvs.github.io/ng2-idle
Apache License 2.0
322 stars 129 forks source link

ng2-idle pauses when the tab is in the background #184

Closed JiaLinYou closed 10 months ago

JiaLinYou commented 1 year ago

NOTE: Due to limited time constraints and resources, we ask that you please use Stack Overflow or similar to troubleshoot or ask general questions, and not use bug reports to solicit help setting up your app.

Describe the bug When the application tab is in the background, onTimeout, onIdleStart, onTimeoutWarning will not be triggered. For example, The logic of the code is to jump to a page after timeout, so if I set the onTimeout parameter to 15s, then it will time out 15 seconds after entering Idle and jump to the page, so when I switch back to this tab page, I should see the page after the jump instead of the previous tab.

To Reproduce Use the DEFAULT_INTERRUPTSOURCES. Set the idle time to 15s, and the timeout to15s. Start up app Immediately upon restarting the apps, minimize the browser window. You should see the new page after 30s.

Expected behavior I hope that when the browser is in the background, it can automatically jump when Idle timeout.

Please tell us about your environment

girish-fuluskar commented 1 year ago

I am also facing the same issue but only for iOS. For Android it is working as expected but for iOS it is not working. Does anyone have any solution for the same?

asfo commented 1 year ago

The only way I think that we can handle that is we store the "latest tick" on a sessionStorage and once the tab is recovered validate from there and keep counting, if the time happens, runs the "timeout function".

Otherwise, we don't have too many ways to do that.

moribvndvs commented 10 months ago

See if #131 fixes the issue for you