Untitled
unknown
javascript
3 years ago
1.9 kB
6
Indexable
/*const electron = require("electron"); const url = require("url"); const path = require("path");*/ const {app,BrowserWindow,ipcMain} = require('electron'); const user = require('./user.js') let mainWindow; function createWindow(){ const win= new BrowserWindow({ width:800, height :700, webPreferences :{ nodeIntegration: true, contextIsolation:false, traceProcessWarnings:true }, }) win.loadFile('index.html') } function createWindow_1(){ const mainWindow = new BrowserWindow({width:1400,height:1050, }); mainWindow.loadFile('main.html');} /* 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) e.sender.send('new-user-created',JSON.stringify(userSaved)) }) ipcMain.handle("get-tasks", async (e, arg) => { const tasks = await Task.find(); e.sender.send("get-tasks", JSON.stringify(tasks)); }); ipcMain.handle("delete-task", async (e, args) => { const taskDeleted = await Task.findByIdAndDelete(args); e.sender.send("delete-task-success", JSON.stringify(taskDeleted)); }); ipcMain.handle("update-task", async (e, args) => { console.log(args); const updatedTask = await Task.findByIdAndUpdate( args.idTaskToUpdate, { name: args.name, pass: args.pass }, { new: true } ); e.sender.send("update-task-success", JSON.stringify(updatedTask)); }); */ module.exports= { createWindow_1,createWindow} app.whenReady().then(createWindow_1,createWindow)
Editor is loading...