Initial commit
This commit is contained in:
26
src/main/index.ts
Normal file
26
src/main/index.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { app, BrowserWindow } from 'electron';
|
||||
import { createMainWindow } from "./mainWindow";
|
||||
import { createSplashWindow } from "./splash";
|
||||
|
||||
function createWindows() {
|
||||
const mainWindow = createMainWindow();
|
||||
const splash = createSplashWindow();
|
||||
|
||||
mainWindow.once("ready-to-show", () => {
|
||||
splash.destroy();
|
||||
mainWindow.show();
|
||||
});
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
createWindows();
|
||||
|
||||
app.on('activate', () => {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindows();
|
||||
});
|
||||
});
|
||||
|
||||
app.on("window-all-closed", () => {
|
||||
if (process.platform !== "darwin")
|
||||
app.quit();
|
||||
});
|
||||
19
src/main/mainWindow.ts
Normal file
19
src/main/mainWindow.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
import { BrowserWindow } from "electron";
|
||||
import { join } from "path";
|
||||
|
||||
export function createMainWindow() {
|
||||
const win = new BrowserWindow({
|
||||
show: false,
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
sandbox: true,
|
||||
contextIsolation: true,
|
||||
devTools: true,
|
||||
preload: join(__dirname, "preload.js")
|
||||
}
|
||||
});
|
||||
|
||||
win.loadURL("https://discord.com/app");
|
||||
|
||||
return win;
|
||||
}
|
||||
18
src/main/splash.ts
Normal file
18
src/main/splash.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { BrowserWindow } from "electron";
|
||||
import { join } from "path";
|
||||
|
||||
export function createSplashWindow() {
|
||||
const splash = new BrowserWindow({
|
||||
transparent: true,
|
||||
frame: false,
|
||||
height: 350,
|
||||
width: 300,
|
||||
center: true,
|
||||
resizable: false,
|
||||
maximizable: false
|
||||
});
|
||||
|
||||
splash.loadFile(join(__dirname, "..", "static", "splash.html"));
|
||||
|
||||
return splash;
|
||||
}
|
||||
1
src/preload/index.ts
Normal file
1
src/preload/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
console.log("banana");
|
||||
Reference in New Issue
Block a user