Files
losadev-tools/app/src/worker/shims/electron.js
T

22 lines
1019 B
JavaScript

// "electron" for the ported main-process modules. Only app.getPath is used outside the dialogs
// (which the browser answers in src/legacy/bridge.js). userData is a virtual folder kept in the
// browser's IndexedDB (see vfs.takePersisted / restore).
const PATHS = { userData: "/userdata", temp: "/tmp", downloads: "/out", documents: "/out", desktop: "/out", home: "/out" };
export const app = {
getPath: (name) => PATHS[name] || `/userdata/${name}`,
getVersion: () => "web",
isPackaged: true,
};
const unavailable = (what) => () => {
throw new Error(`${what} is not available in the browser`);
};
export const dialog = { showOpenDialog: unavailable("dialog"), showSaveDialog: unavailable("dialog"), showMessageBox: unavailable("dialog") };
export const shell = { openPath: async () => "", showItemInFolder: () => {}, openExternal: async () => {} };
export const ipcMain = { handle: () => {}, on: () => {} };
export const BrowserWindow = class {};
export default { app, dialog, shell, ipcMain, BrowserWindow };