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

js setInterval continuing interrupting idletime #163

Open
gadipati opened this issue Nov 3, 2021 · 2 comments
Open

js setInterval continuing interrupting idletime #163

gadipati opened this issue Nov 3, 2021 · 2 comments

Comments

@gadipati
Copy link

gadipati commented Nov 3, 2021

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:

  • @ng-idle version: 2.x
    11.0.3

  • Angular version: 2.x
    10.x.x

  • Browser: [all | Chrome XX | Firefox XX | IE XX | Safari XX | Mobile Chrome XX | Android X.X Web Browser | iOS XX Safari | iOS XX UIWebView | iOS XX WKWebView ]
    All Browsers

  • Language: [all | TypeScript X.X | ES6/7 | ES5]

  • Node: node --version =

@seahsky
Copy link

seahsky commented Nov 11, 2021

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

@girish-fuluskar
Copy link

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();
});

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