mirror of
https://github.com/hydralauncher/hydra.git
synced 2026-01-28 13:21:02 +00:00
17 lines
462 B
TypeScript
17 lines
462 B
TypeScript
import { dialog } from "electron";
|
|
import { WindowManager } from "@main/services";
|
|
import { registerEvent } from "../register-event";
|
|
|
|
const showOpenDialog = async (
|
|
_event: Electron.IpcMainInvokeEvent,
|
|
options: Electron.OpenDialogOptions
|
|
) => {
|
|
if (WindowManager.mainWindow) {
|
|
return dialog.showOpenDialog(WindowManager.mainWindow, options);
|
|
}
|
|
|
|
throw new Error("Main window is not available");
|
|
};
|
|
|
|
registerEvent("showOpenDialog", showOpenDialog);
|