Skip to content

Commit

Permalink
fix: block closing window while rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
xpadev-net committed Oct 18, 2023
1 parent 919cebc commit 181d87a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion electron/rendererWindow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import * as path from "path";
import type { ApiResponsesToRenderer } from "@/@types/response.renderer";

import { baseUrl } from "./context";
import { processingQueue } from "./queue";

let rendererWindow: BrowserWindow;
let isOpen = false;
Expand All @@ -20,7 +21,11 @@ const createRendererWindow = (): void => {
});
isOpen = true;
rendererWindow.removeMenu();
rendererWindow.on("close", () => {
rendererWindow.on("close", (e) => {
if (processingQueue?.status === "processing") {
e.preventDefault();
return;
}
isOpen = false;
});
void rendererWindow.loadURL(`${baseUrl}?renderer`);
Expand Down

0 comments on commit 181d87a

Please sign in to comment.