Ajout d'une base pour la partie Electron

This commit is contained in:
Quentin Millardet
2024-01-13 23:31:03 +01:00
parent 02cb1cd738
commit ed0b56e789
34 changed files with 75 additions and 14830 deletions

31
client/main.js Normal file
View File

@@ -0,0 +1,31 @@
const { app, BrowserWindow, ipcMain } = require('electron')
// inclusion du chemin du module Node.js au tout début de votre fichier
const path = require('node:path')
// modification de votre fonction existante createWindow()
const createWindow = () => {
const win = new BrowserWindow({
width: 1000,
height: 600,
webPreferences: {
preload: path.join(__dirname, 'preload.js')
}
})
win.loadFile('index.html')
win.webContents.openDevTools({'mode' : "detach"})
}
app.whenReady().then(() => {
createWindow()
app.on('activate', () => {
if (BrowserWindow.xgetAllWindows().length === 0) createWindow()
})
ipcMain.handle('ping', () => 'pong')
})
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') app.quit()
})