UC done v1.0
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
const {app, BrowserWindow, screen, Menu} = require("electron");
|
||||
const path = require("path")
|
||||
|
||||
const isMac = process.platform === 'darwin';
|
||||
|
||||
const createMainWindow = ((title, width, height) => {
|
||||
const mainWindows = new BrowserWindow({
|
||||
title: title,
|
||||
width: width,
|
||||
height: height
|
||||
});
|
||||
|
||||
mainWindows.loadFile(path.join(__dirname, '..', 'renderer', 'index.html'))
|
||||
.then(r => console.log('Main window works!'));
|
||||
})
|
||||
|
||||
app.whenReady().then(() => {
|
||||
const title = "Application"
|
||||
const mainScreen = screen.getPrimaryDisplay();
|
||||
const {width: width, height: height} = mainScreen.size;
|
||||
createMainWindow(title, width / 1.5, height / 1.5)
|
||||
|
||||
app.on('activate', () => {
|
||||
if(BrowserWindow.getAllWindows().length === 0){
|
||||
createMainWindow(title, width, height);
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () =>{
|
||||
if(!isMac){
|
||||
app.quit();
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user