mediago-dev--mediago
8224c68f66
Extract shared navigation logic into useBrowserActions hook, fix race conditions in sniffing helper, add event listener cleanup in webview service, split store selectors for granular re-renders, memoize list items, throttle ResizeObserver, and add loading/error states to favorites list. Also remove unused getMachineId IPC handler and fix IPC callback type signatures. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@mediago/electron-preload
Electron preload script package for MediaGo application.
Overview
This package contains the preload script that bridges the communication between the Electron main process and renderer process. It exposes safe APIs to the frontend through Electron's contextBridge.
Features
- Safe IPC communication between main and renderer processes
- Type-safe API definitions
- Centralized preload logic for better maintainability
- Optimized build with esbuild
Usage
In your Electron main process:
import { join } from "path";
import { BrowserWindow } from "electron";
const win = new BrowserWindow({
webPreferences: {
nodeIntegration: false,
contextIsolation: true,
preload: join(
__dirname,
"../node_modules/@mediago/electron-preload/dist/preload.js",
),
},
});
Development
# Build the package
pnpm build
# Watch mode for development
pnpm dev
# Type checking
pnpm types
API
The preload script exposes all Electron APIs through window.electron object, providing type-safe access to:
- File system operations
- Download management
- Browser window controls
- Settings management
- And much more...
See the MediaGoApi type definition for complete API reference.