aboutsummaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.js')
-rw-r--r--src/main.js20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/main.js b/src/main.js
index 9cc58cb..720f1c6 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,37 +1,30 @@
-const {app, BrowserWindow} = require('electron')
+const {app, BrowserWindow, ipcMain} = require('electron')
const path = require('path')
const url = require('url')
let win
function createWindow () {
- // Create the browser window.
win = new BrowserWindow({
width: 800,
height: 600,
frame: false,
- // transparent: true,
titleBarStyle: 'hidden',
webPreferences: {
- nodeIntegration: true
+ nodeIntegration: true,
+ enableRemoteModule: true
}
})
- // and load the index.html of the app.
win.loadURL(url.format({
pathname: path.join(__dirname, 'views/index.html'),
protocol: 'file:',
slashes: true
}))
- // Open the DevTools.
win.webContents.openDevTools()
- // Emitted when the window is closed.
win.on('closed', () => {
- // Dereference the window object, usually you would store windows
- // in an array if your app supports multi windows, this is the time
- // when you should delete the corresponding element.
win = null
})
}
@@ -43,6 +36,13 @@ app.on('window-all-closed', () => {
}
})
+ipcMain.on('renamedChapter', (event, message) => {
+ let focusedWindow = BrowserWindow.getFocusedWindow();
+ focusedWindow.close();
+ let parentWindow = BrowserWindow.getFocusedWindow();
+ parentWindow.webContents.send('renamedChapter', message);
+});
+
app.on('activate', () => {
if (win === null) {
createWindow()