-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.js
47 lines (38 loc) · 1.17 KB
/
main.js
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
'use strict';
/**
* This is the server Javascript file used by Electron.
* The client-side Javascript files are in the js folder.
*/
const electron = require('electron');
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
const ipc = electron.ipcMain;
const dialog = electron.dialog;
let mainWindow;
// Unfortunately having a large index for lunr results in
// "Maximum call stack size exceeded" unless the size is increased
app.commandLine.appendSwitch('js-flags', '--stack-size=32000');
app.on('ready', function() {
// Create the window and display the index page
mainWindow = new BrowserWindow({
width: 800,
height: 600,
minWidth: 400,
minHeight: 300
});
mainWindow.loadURL(`file://${__dirname}/index.html`);
// Select the directory with the exported data from Facebook
ipc.on('select-archive-directory', (event, arg) => {
dialog.showOpenDialog(mainWindow, {
properties: ['openDirectory']
}, function(directories) {
event.sender.send('selected-directory', directories);
});
});
mainWindow.on('closed', function() {
mainWindow = null;
});
});
app.on('window-all-closed', function() {
app.quit();
});