Skip to content

Commit e629a54

Browse files
committed
convert remaining CommonJS modules to ES module syntax
1 parent 673cbd0 commit e629a54

File tree

5 files changed

+16
-12
lines changed

5 files changed

+16
-12
lines changed

src/main/app_setup.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,11 @@ function preventMultipleAppInstances(): void {
77
}
88
}
99

10-
function openMinimizedIfAlreadyExists({ win }: { win: BrowserWindow }): void {
10+
function openMinimizedIfAlreadyExists({
11+
win
12+
}: {
13+
win: BrowserWindow | null;
14+
}): void {
1115
app.on("second-instance", () => {
1216
if (win) {
1317
if (win.isMinimized()) {
@@ -24,15 +28,15 @@ function quitOnWindowsAllClosed(): void {
2428
});
2529
}
2630

27-
function createWindowOnActivate({ win }: { win: BrowserWindow }): void {
31+
function createWindowOnActivate({ win }: { win: BrowserWindow | null }): void {
2832
app.on("activate", () => {
2933
if (!win) {
3034
win = createMainWindow();
3135
}
3236
});
3337
}
3438

35-
export function setupApp({ win }: { win: BrowserWindow }): void {
39+
export function setupApp({ win }: { win: BrowserWindow | null }): void {
3640
preventMultipleAppInstances();
3741
openMinimizedIfAlreadyExists({ win: win });
3842
quitOnWindowsAllClosed();

src/main/index.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ if (is.development && module.hot) {
66
module.hot.accept();
77
}
88

9-
const { app } = require("electron");
10-
const { setupMenu } = require("./menu");
11-
const { init } = require("./init");
12-
const { createMainWindow, setupMainWindow } = require("./window_setup");
9+
import { app } from "electron";
10+
import { setupMenu } from "./menu";
11+
import { init } from "./init";
12+
import { createMainWindow, setupMainWindow } from "./window_setup";
1313

1414
// Maintain reference to window to
1515
// prevent it from being garbage collected

src/main/init.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ function setupUserModelId(): void {
1717
app.setAppUserModelId(packageJson.build.appId);
1818
}
1919

20-
export function init({ win }: { win: BrowserWindow }): void {
20+
export function init({ win }: { win: BrowserWindow | null }): void {
2121
setupErrorHandling();
2222
setupContextMenu();
2323
setupUserModelId();

src/main/window_setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { BrowserWindow, app } from "electron";
2-
const { is } = require("electron-util");
3-
const url = require("url");
4-
const path = require("path");
2+
import { is } from "electron-util";
3+
import url from "url";
4+
import path from "path";
55

66
const DEFAULT_WINDOW_WIDTH = 580;
77
const DEFAULT_WINDOW_HEIGHT = 312;

src/renderer/add_files.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ function cleanExifData(exifHash: any): any {
115115
// When finished working with it, it should be closed,
116116
// when -stay_open False will be written to its stdin to exit the process.
117117
//
118-
// const exiftool = require('node-exiftool')
118+
// import exiftool from "node-exiftool"
119119
// const ep = new exiftool.ExiftoolProcess()
120120
//
121121
// ep

0 commit comments

Comments
 (0)