forked from wulkano/Kap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexports.js
46 lines (35 loc) · 933 Bytes
/
exports.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
'use strict';
const {BrowserWindow, ipcMain} = require('electron');
const pEvent = require('p-event');
const loadRoute = require('./utils/routes');
let exportsWindow = null;
const openExportsWindow = async () => {
if (exportsWindow) {
exportsWindow.focus();
} else {
exportsWindow = new BrowserWindow({
title: 'Exports',
width: 320,
height: 360,
resizable: false,
maximizable: false,
fullscreenable: false,
titleBarStyle: 'hiddenInset',
show: false
});
const titlebarHeight = 37;
exportsWindow.setSheetOffset(titlebarHeight);
loadRoute(exportsWindow, 'exports');
exportsWindow.on('close', () => {
exportsWindow = null;
});
await pEvent(ipcMain, 'exports-ready');
exportsWindow.show();
}
return exportsWindow;
};
const getExportsWindow = () => exportsWindow;
module.exports = {
openExportsWindow,
getExportsWindow
};