Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
ngidle timer resumes when browser sleeps

I am creating the project using angular. In my project i have used the library ngIdle for when the system goes idle it will give the popup with timer and after that user will logout from the system.

The problem in this when browser goes sleep, then timer is resuming.

https://moribvndvs.github.io/ng2-idle/

Here is the code:

idle.setIdle(5);
    // sets a timeout period of 5 seconds. after 10 seconds of inactivity, the user will be considered timed out.
    idle.setTimeout(60);
    // sets the default interrupts, in this case, things like clicks, scrolls, touches to the document
    idle.setInterrupts(DEFAULT_INTERRUPTSOURCES);

    idle.onIdleEnd.subscribe(() => this.idleState = 'No longer idle.');
    idle.onTimeout.subscribe(() => {
      this.idleState = 'Timed out!';
      this.timedOut = true;
    });
    idle.onIdleStart.subscribe(() => this.idleState = 'You\'ve gone idle!');
    idle.onTimeoutWarning.subscribe((countdown) => {
    this.idleState = 'You will time out in ' + countdown + ' seconds!'
    console.log(this.idleState)
  }
    
    );

    // sets the ping interval to 15 seconds
    keepAlive.interval(15);

    keepAlive.onPing.subscribe(() => this.lastPing = new Date());

    this.reset();

 reset() {
  //  this.idle.setTimeout(false);
    this.idle.watch();
    this.idleState = 'Started.';
    this.timedOut = false;
  }

When i put the this.idle.setTimeout(false); in the reset then timer is not initiating.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!