mirror of
https://github.com/imsyy/SPlayer.git
synced 2025-11-25 11:29:26 +08:00
30 lines
712 B
JavaScript
30 lines
712 B
JavaScript
const { autoUpdater } = require("electron-updater");
|
|
|
|
const checkForUpdates = () => {
|
|
autoUpdater.checkForUpdates();
|
|
};
|
|
|
|
export const configureAutoUpdater = () => {
|
|
checkForUpdates();
|
|
|
|
// 监听检查更新的事件
|
|
autoUpdater.on("checking-for-update", () => {
|
|
console.log("Checking for update...");
|
|
});
|
|
|
|
autoUpdater.on("update-available", (info) => {
|
|
console.log("Update available:", info);
|
|
});
|
|
|
|
autoUpdater.on("update-not-available", () => {
|
|
console.log("Update not available.");
|
|
});
|
|
|
|
autoUpdater.on("update-downloaded", () => {
|
|
console.log("Update downloaded. Ready to install.");
|
|
|
|
// 在需要的时候,触发安装更新
|
|
autoUpdater.quitAndInstall();
|
|
});
|
|
};
|