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

js setInterval continuing interrupting idletime #163

Open ClosedBeans opened 2 years ago

ClosedBeans commented 2 years ago

I'm submitting a ... (check one with "x")

[ ] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[X] support request => Please do not submit support request here, instead see https://github.com/moribvndvs/ng2-idle/blob/master/CONTRIBUTING.md#getting-help

Current behavior My component has code to refresh data by using setInterval for every 30 seconds. Which is resetting idle time after every 30 seconds.

Expected behavior It should not count idle time when using js setInterval function.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

seahsky commented 2 years ago

Mind to share your code of your component / the part which refreshes the data? That helps a lot to reproduce the issue.

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?

"name": "@ng-idle/core", "version": "11.1.0", "description": "A module for detecting and responding to the user becoming idle in Angular applications.", "repository": { "type": "git", "url": "git+https://github.com/moribvndvs/ng2-idle.git"

Code:

this.platform.pause.subscribe(async () => { this.updateAppCloseTime(); clearInterval(this.autoSyncInterval); console.log('interval cleared');

idle.setIdle(5); idle.setTimeout(1 * 60); idle.setInterrupts(DEFAULT_INTERRUPTSOURCES); idle.setAutoResume(2);

idle.onTimeoutWarning.subscribe((countdown: number) => { console.log("Timeout warning: ", countdown); });

idle.onTimeout.subscribe(() => { console.log("Timeout"); this.logout(); this.timedOut = true; });

idle.watch(); });