-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.js
More file actions
60 lines (54 loc) · 1.39 KB
/
main.js
File metadata and controls
60 lines (54 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
const { app, BrowserWindow, ipcMain, Menu, dialog } = require('electron');
const path = require('path');
const { jsonToYaml, yamlToJson } = require('./modules/converter');
function createWindow() {
const win = new BrowserWindow({
width: 1200,
height: 800,
minWidth: 1000,
minHeight: 700,
icon: path.join(__dirname, 'assets/icon.png'),
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
contextIsolation: true
}
});
win.loadFile('renderer/index.html');
const menu = Menu.buildFromTemplate([
{
label: 'File',
submenu: [
{ role: 'reload' },
{ role: 'toggleDevTools' }
]
},
{
label: 'Edit',
submenu: [
{ role: 'copy' },
{ role: 'paste' }
]
},
{
label: 'About',
click: () => {
dialog.showMessageBox(win, {
type: 'info',
title: 'About OpenMEOW',
message: 'OpenMEOW v1.0\nCreated by FedotovDev & Meowefixe',
buttons: ['Meow!']
});
}
},
{
label: 'Exit',
click: () => {
app.quit();
}
}
]);
Menu.setApplicationMenu(menu);
}
app.whenReady().then(createWindow);
ipcMain.handle('convert:json2yaml', (_, jsonStr) => jsonToYaml(jsonStr));
ipcMain.handle('convert:yaml2json', (_, yamlStr) => yamlToJson(yamlStr));