mirror of
https://github.com/mileswolfallen2/gelectron.git
synced 2026-12-03 23:53:26 +00:00
- Introduced contextBridge module for exposing APIs to the main world. - Added dialog module for handling open, save, and message dialogs. - Created index module as a drop-in replacement for Electron's main API. - Implemented ipcMain and ipcRenderer modules for inter-process communication. - Developed menu and menu item modules for creating application menus. - Added nativeImage module for handling images in various formats. - Implemented notification module for displaying system notifications. - Created preload-loader for injecting preload scripts into the renderer process. - Developed runtime module for running Electron apps in a Node.js environment. - Added safe-storage module for basic string encryption and decryption. - Implemented shell module for opening external URLs and managing file paths. - Created tray module for managing system tray icons and menus. - Developed webContents utilities for interacting with browser windows.
26 lines
537 B
JavaScript
26 lines
537 B
JavaScript
'use strict';
|
|
|
|
/**
|
|
* Gelectron - webContents utilities (Electron compatible)
|
|
*/
|
|
|
|
const { BrowserWindow } = require('./browser-window');
|
|
|
|
const webContents = {
|
|
getAllWebContents() {
|
|
return BrowserWindow.getAllWindows().map((win) => win.webContents);
|
|
},
|
|
|
|
getFocusedWebContents() {
|
|
const focused = BrowserWindow.getFocusedWindow();
|
|
return focused ? focused.webContents : null;
|
|
},
|
|
|
|
fromId(id) {
|
|
const win = BrowserWindow.fromId(id);
|
|
return win ? win.webContents : null;
|
|
},
|
|
};
|
|
|
|
module.exports = webContents;
|