Skip to content

Commit

Permalink
Build: an object could not be cloned
Browse files Browse the repository at this point in the history
  • Loading branch information
baruchiro committed Sep 6, 2024
1 parent f649303 commit 46e9b28
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions packages/main/src/handlers/updater.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,27 @@ import logger from '../logging/logger';
const { autoUpdater } = electronUpdater;

export interface UpdateInfo {
version: string
version: string;
}

autoUpdater.logger = logger;
autoUpdater.autoDownload = false;

export const checkForUpdate = async () => new Promise<UpdateInfo | false>((resolve, reject) => {
autoUpdater.once('error', reject);
autoUpdater.once('update-available', (info: UpdateInfo) => resolve(info));
autoUpdater.once('update-not-available', () => resolve(false));
autoUpdater.checkForUpdates();
});
export const checkForUpdate = async () =>
new Promise<UpdateInfo | false>((resolve, reject) => {
autoUpdater.once('error', reject);
autoUpdater.once('update-available', (info: UpdateInfo) => resolve(info));
autoUpdater.once('update-not-available', () => resolve(false));
autoUpdater.checkForUpdates();
});

export const downloadUpdate = async () => new Promise<electronUpdater.UpdateDownloadedEvent>((resolve, reject) => {
autoUpdater.once('error', reject);
autoUpdater.once('update-downloaded', resolve);
autoUpdater.downloadUpdate();
});
export const downloadUpdate = async () =>
new Promise<electronUpdater.UpdateDownloadedEvent>((resolve, reject) => {
autoUpdater.once('error', reject);
autoUpdater.once('update-downloaded', resolve);
autoUpdater.downloadUpdate();
});

export const quitAndInstall = () => setImmediate(() => autoUpdater.quitAndInstall());
export const quitAndInstall = () => {
setImmediate(() => autoUpdater.quitAndInstall());
};

0 comments on commit 46e9b28

Please sign in to comment.