aboutsummaryrefslogtreecommitdiff
path: root/src/main.js
diff options
context:
space:
mode:
authorKumar Priyansh <[email protected]>2020-07-18 01:02:26 +0530
committerKumar Priyansh <[email protected]>2020-07-18 01:02:26 +0530
commit796b7f3f1eeaee548a9df67e9a72bd849bc97afb (patch)
tree81f994dc01ff213a11f640f1092950ffeec36385 /src/main.js
parent61d76581dfd79af06da591305e2c8b2e01790b57 (diff)
downloadauthorr-796b7f3f1eeaee548a9df67e9a72bd849bc97afb.tar.xz
authorr-796b7f3f1eeaee548a9df67e9a72bd849bc97afb.zip
Rename Chapter Function: Event Handling
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()