29 lines
692 B
TypeScript
29 lines
692 B
TypeScript
import { autoUpdater } from "electron-updater";
|
|
import store from "../store/store";
|
|
|
|
let continuousUpdatesTriggered = false;
|
|
|
|
async function checkForAppUpdatesContinuously(): Promise<void> {
|
|
if (!continuousUpdatesTriggered) {
|
|
continuousUpdatesTriggered = true;
|
|
checkForAppUpdates();
|
|
setInterval(
|
|
() => {
|
|
checkForAppUpdates();
|
|
},
|
|
1000 * 60 * 30,
|
|
);
|
|
}
|
|
}
|
|
async function checkForAppUpdates(channel?: string | null): Promise<void> {
|
|
if (channel) {
|
|
autoUpdater.channel = channel;
|
|
//Persist to store
|
|
store.set("app.channel", channel);
|
|
}
|
|
|
|
autoUpdater.checkForUpdates();
|
|
}
|
|
|
|
export { checkForAppUpdates, checkForAppUpdatesContinuously };
|