testing
This commit is contained in:
parent
e4aa477f5f
commit
d739349004
6 changed files with 86 additions and 17 deletions
|
|
@ -6,6 +6,7 @@ import { backgroundMitt } from '@/modules/emitter';
|
|||
import { RenderMessage, WindowState } from "@/types";
|
||||
import { loadWinState, saveToJson } from "./helpers";
|
||||
import * as path from "path";
|
||||
const { autoUpdater } = require('electron-updater');
|
||||
|
||||
interface IpcRendererPayload {
|
||||
endpoint: string;
|
||||
|
|
@ -64,7 +65,7 @@ const onWindowMount = (): void => {
|
|||
// Handle win nav-bar event.
|
||||
ipcMain.removeAllListeners("nav-bar") // avoid setting duplicate handlers
|
||||
ipcMain.on("nav-bar", onNavBar);
|
||||
|
||||
|
||||
// Gateway for messages to the frontend.
|
||||
backgroundMitt.removeAllListeners("ipc-renderer")
|
||||
backgroundMitt.on("ipc-renderer", renderMessage);
|
||||
|
|
@ -109,7 +110,7 @@ export async function createWindow(): Promise<void> {
|
|||
// Load the URL.
|
||||
if (process.env.WEBPACK_DEV_SERVER_URL) {
|
||||
win.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string); // dev
|
||||
}
|
||||
}
|
||||
|
||||
else {
|
||||
createProtocol("app");
|
||||
|
|
@ -124,6 +125,7 @@ export async function createWindow(): Promise<void> {
|
|||
win.on("resize", saveWindowState);
|
||||
|
||||
win.once('ready-to-show', () => {
|
||||
autoUpdater.checkForUpdatesAndNotify();
|
||||
if (win) win.show()
|
||||
})
|
||||
|
||||
|
|
@ -139,3 +141,11 @@ export async function createWindow(): Promise<void> {
|
|||
|
||||
});
|
||||
}
|
||||
|
||||
autoUpdater.on('update-available', () => {
|
||||
if (win) win.webContents.send('update_available');
|
||||
});
|
||||
|
||||
autoUpdater.on('update-downloaded', () => {
|
||||
if (win) win.webContents.send('update_downloaded');
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue