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

Ng Idle pauses when system goes to sleep mode #112

Open
srishti-sqm opened this issue Aug 2, 2018 · 9 comments
Open

Ng Idle pauses when system goes to sleep mode #112

srishti-sqm opened this issue Aug 2, 2018 · 9 comments

Comments

@srishti-sqm
Copy link

I have used Ng Idle version 6.0.0-beta.3 and using angular 6, this library is working fine system is on but timer stops when system goes to sleep mode. How to achieve idle state is system goes to sleep?

@earbullet
Copy link

I'm experiencing a similar issue with the system going to sleep. idle occurs, laptop sleeps, laptop wakes and then onIdleEnd does not fire.

To duplicate:
1 - Set my idle timer at 5 seconds.
2 - onIdleStart does a console.log, see the output
3 - Widows / sleep
4 - wake
5 - Move mouse on browser and onIdleEnd does not fire.

after waking idle.isRunning() = false.

@earbullet
Copy link

Ok, so immediately after posting my issue with onIdleEnd I figured out my mistake. If I didn't post, I'd have never figured it out. There is a timeout after onIdleStart that defaults to 30 seconds.

I added this line and things are working fine now.
this.idle.setTimeout(false);

I also tested a sleep for the idle to fire:
1 - set 60 second timer
2 - windows / sleep
3 - wake
4 - my console.log output for idle was there.

This particular timer is using SimpleExpiry. I've not tested this use case with IdleExpiry.

@earbullet
Copy link

earbullet commented Oct 5, 2018 via email

@alobban
Copy link

alobban commented Oct 5, 2018

@earbullet can you indicate where you added this line of code?

@earbullet
Copy link

earbullet commented Oct 5, 2018 via email

@rajasekarsphcl
Copy link

@earbullet what is the actual solution for this issue ?

@earbullet
Copy link

constructor(@Inject('GlobalIdle') private _idle: Idle)

....

const documnetInterruptsOnly = DEFAULT_INTERRUPTSOURCES.slice(0, 1);
this._idle.setInterrupts(documnetInterruptsOnly);

this._idle.onIdleEnd.subscribe(() => {
....
});

this._idle.onIdleStart.subscribe(() => {
....
});

this._idle.setTimeout(false); // this is the line that I was missing
this._idle.watch();

@rafay-veemed
Copy link

constructor(@Inject('GlobalIdle') private _idle: Idle)

....

const documnetInterruptsOnly = DEFAULT_INTERRUPTSOURCES.slice(0, 1);
this._idle.setInterrupts(documnetInterruptsOnly);

this._idle.onIdleEnd.subscribe(() => {
....
});

this._idle.onIdleStart.subscribe(() => {
....
});

this._idle.setTimeout(false); // this is the line that I was missing
this._idle.watch();

Does not works on Mac!
Any idea or fix?

@mcrtricolor
Copy link

This is not a solution to the problem, this only disables the timeout function.

I want to use the idle and timeout function, and that it takes into account if the user shutdown or put to sleep the computer.

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

6 participants