Skip to content

Commit de400cd

Browse files
committed
Trim down to the minimum required web wrapper
1 parent 66d5988 commit de400cd

File tree

3 files changed

+26
-83
lines changed

3 files changed

+26
-83
lines changed

src/app.tsx

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/index.html

Lines changed: 0 additions & 24 deletions
This file was deleted.

src/index.ts

Lines changed: 26 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,41 @@
11
import { app, BrowserWindow } from 'electron';
2-
import installExtension, { REACT_DEVELOPER_TOOLS } from 'electron-devtools-installer';
3-
import { enableLiveReload } from 'electron-compile';
2+
3+
const APP_URL = 'https://app.httptoolkit.tech';
44

55
// Keep a global reference of the window object, if you don't, the window will
66
// be closed automatically when the JavaScript object is garbage collected.
77
let mainWindow: Electron.BrowserWindow | null = null;
88

9-
const isDevMode = process.execPath.match(/[\\/]electron/);
10-
11-
if (isDevMode) {
12-
enableLiveReload({strategy: 'react-hmr'});
13-
}
14-
159
const createWindow = async () => {
16-
// Create the browser window.
17-
mainWindow = new BrowserWindow({
18-
width: 800,
19-
height: 600,
20-
});
21-
22-
// and load the index.html of the app.
23-
mainWindow.loadURL(`file://${__dirname}/index.html`);
24-
25-
// Open the DevTools.
26-
if (isDevMode) {
27-
await installExtension(REACT_DEVELOPER_TOOLS);
28-
mainWindow.webContents.openDevTools();
29-
}
30-
31-
// Emitted when the window is closed.
32-
mainWindow.on('closed', () => {
33-
// Dereference the window object, usually you would store windows
34-
// in an array if your app supports multi windows, this is the time
35-
// when you should delete the corresponding element.
36-
mainWindow = null;
37-
});
10+
mainWindow = new BrowserWindow({
11+
width: 800,
12+
height: 600,
13+
webPreferences: {
14+
nodeIntegration: false
15+
}
16+
});
17+
18+
mainWindow.loadURL(APP_URL);
19+
20+
mainWindow.on('closed', () => {
21+
mainWindow = null;
22+
});
3823
};
3924

40-
// This method will be called when Electron has finished
41-
// initialization and is ready to create browser windows.
42-
// Some APIs can only be used after this event occurs.
4325
app.on('ready', createWindow);
4426

45-
// Quit when all windows are closed.
4627
app.on('window-all-closed', () => {
47-
// On OS X it is common for applications and their menu bar
48-
// to stay active until the user quits explicitly with Cmd + Q
49-
if (process.platform !== 'darwin') {
50-
app.quit();
51-
}
28+
// On OS X it is common for applications and their menu bar
29+
// to stay active until the user quits explicitly with Cmd + Q
30+
if (process.platform !== 'darwin') {
31+
app.quit();
32+
}
5233
});
5334

5435
app.on('activate', () => {
55-
// On OS X it's common to re-create a window in the app when the
56-
// dock icon is clicked and there are no other windows open.
57-
if (mainWindow === null) {
58-
createWindow();
59-
}
60-
});
61-
62-
// In this file you can include the rest of your app's specific main process
63-
// code. You can also put them in separate files and import them here.
36+
// On OS X it's common to re-create a window in the app when the
37+
// dock icon is clicked and there are no other windows open.
38+
if (mainWindow === null) {
39+
createWindow();
40+
}
41+
});

0 commit comments

Comments
 (0)