Files
electron-egg/electron/preload/index.js
wallace5303 8c833b4e6b 优化代码
2022-02-23 23:52:12 +08:00

43 lines
983 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
'use strict';
/*************************************************
** preload为预加载模块该文件将会在程序启动时加载 **
*************************************************/
const is = require('electron-is');
const tray = require('../library/tray');
const security = require('../library/security');
const awaken = require('../library/awaken');
/**
* 预加载模块入口
*/
module.exports = async (app) => {
//已实现的功能模块,可选择性使用和修改
tray.install(app);
security.install(app);
awaken.install(app);
loadUpdate(app);
}
/**
* 加载自动升级模块
*/
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();
// 是否检查更新
if (config.force) {
autoUpdater.checkUpdate();
}
}
}