I would like to implement a 'screen saver' behaviour in my Angular application built with Electron when the application is idle for an amount of time (let's say for 10 seconds). So, if 10 seconds pass in the application without any action from the user (or even the application itself?), a screen with a message should be shown, and this screen will be removed when user has any interaction with the application.
What would be the recommended way? Should I implement this behaviour in a custom way (set a timer which will be erased by any user action etc like this or is there any built-in solution in electron/Angular?
Please note that I do not want to check for the general system's idle state, just the application's.
UPDATE:
I have tried to use UserIdleService in this way:
this._userIdle.onIdleStatusChanged().subscribe((isIdle) => {
if (isIdle) {
// code to show a screen saver image
} else {
this._userIdle.resetTimer();
// code to hide the screen saver image
}
});
But I see the event getting fired every 1 second, despite my configuration for this module which is as following:
UserIdleModule.forRoot(
{
idle: 100000,
timeout: 1000000,
ping: 60
}
)
What could cause this issue?