Integrates ALS with Electron by making app properly show dialog before quitting. Additional integrations can be set up by providing options.
Usage:
// Your Electron entry point
const { app, BrowserWindow } = require("electron"); // Import Electron stuff
const remote = require("@electron/remote/main"); // Required since Electron 12
remote.initialize(); // Required since Electron 12
const integrate = require("leaflet-advenced-layer-system/ElectronIntegration"); // Import integration function
function createWindow () {
// Create window
const mainWindow = new BrowserWindow({
frame: false, // Required to use ElectronIntegrationOptions.useToolbarAsFrame = true
webPreferences: {
enableRemoteModule: true, // Required to use ElectronIntegrationOptions.useToolbarAsFrame = true
nodeIntegration: true,
contextIsolation: false, // Required since Electron 12
}
});
remote.enable(mainWindow.webContents); // Required since Electron 12
// Integrate ALS with Electron
integrate(mainWindow, {
// Options...
});
// Do your other stuff...
}