Introduction
some functions of desktop applications need to be loaded when the software is started; The controller layer code is executed only when the front end sends a request.
Example
const is = require('electron-is');const tray = require('../library/tray');const security = require('../library/security');const awaken = require('../library/awaken');/*** Preload module entry*/module.exports = async (app) => {// Realized functional modules, which can be used and modified selectivelytray.install(app);security.install(app);awaken.install(app);loadUpdate(app);}/*** Load automatic upgrade module*/function loadUpdate (app) {const config = app.config.autoUpdate;if ( (is.windows() && config.windows) || (is.macOS() && config.macOS) || (is.linux() && config.linux) ) {const autoUpdater = require('../library/autoUpdater');autoUpdater.install();// Check for updatesif (config.force) {autoUpdater.checkUpdate();}}}
