Untitled
unknown
javascript
4 years ago
1.2 kB
5
Indexable
const electron = require("electron"); const url = require("url"); const path = require("path"); const {app,BrowserWindow} = electron; let mainWindow; function createWindow_1(){ const win= new BrowserWindow({ width:800, height :700, webPreferences :{ nodeIntegration: true, contextIsolation:false, traceProcessWarnings:true }, }) win.loadFile('src/index.html') } function createWindow(){ mainWindow = new BrowserWindow({width:1400,height:1050}); mainWindow.loadURL( url.format({ pathname: path.join(__dirname, "main.html"), protocol: "file:", slashes: true }) ); mainWindow.on('closed', () => { mainWindow = null; }) } app.on("ready", createWindow); app.on('window-all-closed', () => { if(process.platform !== 'darwin'){ app.quit() } }); app.on('activate',() => { if (win === null){ createWindow() } }); ipcMain.handle('new', async (e, arg) => { const newUser = new user(arg) const userSaved = await newUser.save() console.log(userSaved) }) module.exports= { createWindow_1} app.whenReady().then(createWindow_1)
Editor is loading...