Home:ALL Converter>Electron App -How to automatically log out a user after inactivity for 15 minutes?

Electron App -How to automatically log out a user after inactivity for 15 minutes?

Ask Time:2016-08-16T02:45:05         Author:javascript2016

Json Formatter

I am making an electron app and wonder how I can automatically log out the user after being inactive for lets say 15 minutes! Thanks a lot!

const electron = require('electron');
const app = electron.app;

let willQuitApp = false;
let window;

app.on('ready', () => {
  window = new electron.BrowserWindow();

  window.on('close', (e) => {
    if (willQuitApp) {
    window = null;
   } else {
      /* the user only tried to close the window */
    e.preventDefault();
    window.hide();
   }
  });

  window.loadURL(`mypage`); /* load your page */

});
app.on('activate', () => window.show());

app.on('before-quit', () => willQuitApp = true);

Author:javascript2016,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/38961039/electron-app-how-to-automatically-log-out-a-user-after-inactivity-for-15-minute
Vadim Macagon :

If you're interested in idle time in your app specifically then this has been previously answered. On the other hand if you're interested in system idle time then you'll want to use https://github.com/paulcbetts/node-system-idle-time",
2016-08-16T04:02:15
yy