Compare commits
1 Commits
main
...
nonIsolate
| Author | SHA1 | Date |
|---|---|---|
|
|
990ae9a7da |
|
|
@ -25,6 +25,8 @@ const createWindow = () => {
|
|||
height: 720,
|
||||
webPreferences: {
|
||||
preload: path.join(__dirname, "preload.js"),
|
||||
nodeIntegration: true,
|
||||
contextIsolation: false,
|
||||
},
|
||||
icon: "./resources/icon.png",
|
||||
});
|
||||
|
|
|
|||
|
|
@ -3,6 +3,11 @@
|
|||
|
||||
import { contextBridge, ipcRenderer } from "electron";
|
||||
import type { FolderTree } from "./types/global";
|
||||
import fs from "fs";
|
||||
import * as pty from "node-pty";
|
||||
|
||||
window.fs = fs;
|
||||
window.pty = pty;
|
||||
|
||||
// Centralized routing for terminal events: keep a single ipcRenderer listener
|
||||
// and forward events to subscribed callbacks. Each `onTerminal*` returns an
|
||||
|
|
@ -23,7 +28,7 @@ ipcRenderer.on("terminal:exit", (_ev, id: string, exitCode: number) => {
|
|||
else console.warn(`No exit callback for terminal ${id}`);
|
||||
});
|
||||
|
||||
contextBridge.exposeInMainWorld("electronAPI", {
|
||||
window.electronAPI = {
|
||||
openFolder: () =>
|
||||
ipcRenderer.invoke("dialog:openFolder") as Promise<FolderTree | null>,
|
||||
|
||||
|
|
@ -91,4 +96,4 @@ contextBridge.exposeInMainWorld("electronAPI", {
|
|||
terminalExitCallbacks.set(id, callback);
|
||||
return () => terminalExitCallbacks.delete(id);
|
||||
},
|
||||
});
|
||||
};
|
||||
|
|
|
|||
|
|
@ -55,8 +55,8 @@ declare global {
|
|||
id: string,
|
||||
callback: (exitCode: number) => void,
|
||||
) => () => void;
|
||||
removeAllTerminalListeners: () => void;
|
||||
};
|
||||
fs: typeof import("fs");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue