T
T
TMLEX2020-05-05 14:44:54
JavaScript
TMLEX, 2020-05-05 14:44:54

Why does electron clear the session after every application close?

Regardless of my operations, every time after closing the application, the session is cleared, even with the demo application that is installed during installation, if nothing is changed.
In the demo application, a BrowserWindow is created, in which, for example, Yandex opens, I log in, close the application, open it, and have to log in again.
I tried to substitute different parameters when creating the BrowserWindow, but nothing helped (

const {app, BrowserWindow} = require('electron');


var storage = new StorageService('data');

// Handle creating/removing shortcuts on Windows when installing/uninstalling.
if (require('electron-squirrel-startup')) { // eslint-disable-line global-require
  app.quit();
}

// Keep a global reference of the window object, if you don't, the window will
// be closed automatically when the JavaScript object is garbage collected.
var mainWindow;

const createWindow = () => {

  // Create the browser window.
  mainWindow = new BrowserWindow({
    width: 800,
    height: 600,
  });

  mainWindow.loadURL('https://yandex.ru/');
};

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.on('ready', createWindow);

// Quit when all windows are closed.
app.on('window-all-closed', () => {
  // On OS X it is common for applications and their menu bar
  // to stay active until the user quits explicitly with Cmd + Q
  if (process.platform !== 'darwin') {
    app.quit();
  }
});

app.on('activate', () => {
  // On OS X it's common to re-create a window in the app when the
  // dock icon is clicked and there are no other windows open.
  if (mainWindow === null) {
    createWindow();
  }
});

// In this file you can include the rest of your app's specific main process
// code. You can also put them in separate files and import them here.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dubolom Unicellular, 2020-05-05
@duboloms

To prevent your application from running in the background (this loads the computer)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question