-
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactored mainWindow to customWindow
- Loading branch information
Showing
5 changed files
with
55 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,12 +4,13 @@ | |
"description": "Template to create a desktop app with Svelte, Electron and TypeScript (with electron-updater, electron-reload and electron-builder)", | ||
"author": "Samuele de Tomasi <[email protected]>", | ||
"license": "MIT", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"main": "dist/index.js", | ||
"scripts": { | ||
"nodemon": "nodemon", | ||
"dev": "rollup -c -w", | ||
"start": "npm run compile && electron .", | ||
"start:svelte": "rollup -c & npm run compile && electron .", | ||
"compile": "tsc", | ||
"out:win": "rollup -c && tsc && electron-builder build --win --publish never", | ||
"publish:win": "rollup -c && tsc && electron-builder build --win --publish always" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
import { ipcMain } from 'electron'; | ||
import { app } from 'electron'; | ||
import { autoUpdater } from "electron-updater"; | ||
import Main from "./mainWindow"; | ||
import path from "path"; | ||
|
||
import CustomWindow from "./customWindow"; | ||
|
||
import systemInfo from './IPC/systemInfo'; | ||
import updaterInfo from './IPC/updaterInfo'; | ||
|
||
require('electron-reload')(__dirname); | ||
|
||
let main = new Main(); | ||
let mainWindow: CustomWindow; | ||
|
||
main.onEvent.on("window-created", ()=> { | ||
systemInfo.initIpcMain(ipcMain, main.window); | ||
updaterInfo.initIpcMain(ipcMain, main.window); | ||
app.on('ready', async () => { | ||
await createMainWindow(); | ||
}); | ||
|
||
updaterInfo.initAutoUpdater(autoUpdater, main.window); | ||
app.on('window-all-closed', () => { | ||
if (process.platform !== 'darwin') { | ||
app.quit(); | ||
} | ||
}); | ||
|
||
async function createMainWindow() { | ||
mainWindow = new CustomWindow(); | ||
const urlPage = path.join(__dirname, 'www', 'index.html'); | ||
mainWindow.createWindow(urlPage); | ||
|
||
await mainWindow.setIpcMain([systemInfo, updaterInfo]); | ||
|
||
updaterInfo.initAutoUpdater(autoUpdater, mainWindow.window); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters