silverwolf-x's picture
download
raw
1.12 kB
// Native
import { join } from "path";
import { format } from "url";
// Packages
import { BrowserWindow, app, ipcMain, IpcMainEvent } from "electron";
import isDev from "electron-is-dev";
import prepareNext from "electron-next";
// Prepare the renderer once the app is ready
app.on("ready", async () => {
await prepareNext("./renderer");
const mainWindow = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
preload: join(__dirname, "preload.js"),
},
});
const url = isDev
? "http://localhost:8000/"
: format({
pathname: join(__dirname, "../renderer/out/index.html"),
protocol: "file:",
slashes: true,
});
mainWindow.loadURL(url);
});
// Quit the app once all windows are closed
app.on("window-all-closed", app.quit);
// listen the channel `message` and resend the received message to the renderer process
ipcMain.on("message", (event: IpcMainEvent, message: any) => {
console.log(message);
setTimeout(() => event.sender.send("message", "hi from electron"), 500);
});

Xet Storage Details

Size:
1.12 kB
·
Xet hash:
dc32cb050758a6e658520b237a1085e212d34deaffc4098380faeac68f0b18e9

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.