moribvndvs / ng2-idle

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

NG Idle pauses if computer goes to sleep mode? #110

Closed alexsim88 closed 8 months ago

alexsim88 commented 5 years ago

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

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

Current behavior If I have a page opened and the countdown starts and I put my laptop to sleep, when I turn on my laptop again I am able to resume. Is this expected? Just want to check if I have implemented it correctly. Thank you!

Expected behavior

Minimal reproduction of the problem with instructions

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

Please tell us about your environment:

ZahraFatima commented 5 years ago

facing same issue

moribvndvs commented 5 years ago

Do you have any sort of snippet that you can post to show your ng-idle setup?

ZahraFatima commented 5 years ago

idleTimeOut(time) { this.idle.setIdle(time); this.idle.setTimeout(30); this.idle.setInterrupts(DEFAULT_INTERRUPTSOURCES);

this.idleEndSubscription = this.idle.onIdleEnd.subscribe(() => {
  this.idleState = 'No longer idle.';
  this.idle.watch();
  this.reset();
});

this.timeOutSubscription = this.idle.onTimeout.subscribe(() => {
  this.idleState = 'Timed out!';
  this.logout();
});

this.idleStartSubscription = this.idle.onIdleStart.subscribe(() => {
  if (this.timeoutModalRef !== undefined) {
    this.timeoutModalRef.close();
  }
  if (!this.isRequesting)
    this.openTimeoutModal(this.content);
  this.idleState = 'You\'ve gone idle!';
});

this.timeOutWarningSubscription = this.idle.onTimeoutWarning.subscribe((countdown) => {
  this.warningTimeout = countdown + 's';
  this.percentage = countdown * 100 / 30;
  this.idleState = 'You will be automatically logged out in ' + countdown + ' seconds!';
});

this.keepalive.interval(15);
this.keepalive.onPing.subscribe(() => this.lastPing = new Date());
this.reset();

}

subinmathewit commented 5 years ago

Any updates? i am also facing the same issue

nicolae-olariu commented 5 years ago

Did you guys find a way to add the Sleep interrupt somehow?

Thank you @HackedByChinese for this amazing library!