diff --git a/docs/fiddles/features/dark-mode/main.js b/docs/fiddles/features/dark-mode/main.js index f28419afd5..00a343c8ac 100644 --- a/docs/fiddles/features/dark-mode/main.js +++ b/docs/fiddles/features/dark-mode/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron') +const { app, BrowserWindow, ipcMain, nativeTheme } = require('electron/main') const path = require('node:path') function createWindow () { diff --git a/docs/fiddles/features/dark-mode/preload.js b/docs/fiddles/features/dark-mode/preload.js index 3def9e06ed..752d9d71a0 100644 --- a/docs/fiddles/features/dark-mode/preload.js +++ b/docs/fiddles/features/dark-mode/preload.js @@ -1,4 +1,4 @@ -const { contextBridge, ipcRenderer } = require('electron') +const { contextBridge, ipcRenderer } = require('electron/renderer') contextBridge.exposeInMainWorld('darkMode', { toggle: () => ipcRenderer.invoke('dark-mode:toggle'), diff --git a/docs/fiddles/features/drag-and-drop/main.js b/docs/fiddles/features/drag-and-drop/main.js index 9ee4431961..0cf045a7c9 100644 --- a/docs/fiddles/features/drag-and-drop/main.js +++ b/docs/fiddles/features/drag-and-drop/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, ipcMain } = require('electron') +const { app, BrowserWindow, ipcMain } = require('electron/main') const path = require('node:path') const fs = require('node:fs') const https = require('node:https') diff --git a/docs/fiddles/features/drag-and-drop/preload.js b/docs/fiddles/features/drag-and-drop/preload.js index 7e698ebb54..3c02ab61c1 100644 --- a/docs/fiddles/features/drag-and-drop/preload.js +++ b/docs/fiddles/features/drag-and-drop/preload.js @@ -1,7 +1,5 @@ -const { contextBridge, ipcRenderer } = require('electron') +const { contextBridge, ipcRenderer } = require('electron/renderer') contextBridge.exposeInMainWorld('electron', { - startDrag: (fileName) => { - ipcRenderer.send('ondragstart', fileName) - } + startDrag: (fileName) => ipcRenderer.send('ondragstart', fileName) }) diff --git a/docs/fiddles/features/keyboard-shortcuts/global/main.js b/docs/fiddles/features/keyboard-shortcuts/global/main.js index 8b43433a4a..991c70d25f 100644 --- a/docs/fiddles/features/keyboard-shortcuts/global/main.js +++ b/docs/fiddles/features/keyboard-shortcuts/global/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, globalShortcut } = require('electron') +const { app, BrowserWindow, globalShortcut } = require('electron/main') function createWindow () { const win = new BrowserWindow({ diff --git a/docs/fiddles/features/keyboard-shortcuts/interception-from-main/main.js b/docs/fiddles/features/keyboard-shortcuts/interception-from-main/main.js index 80e4012c81..62df976ea7 100644 --- a/docs/fiddles/features/keyboard-shortcuts/interception-from-main/main.js +++ b/docs/fiddles/features/keyboard-shortcuts/interception-from-main/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') app.whenReady().then(() => { const win = new BrowserWindow({ width: 800, height: 600 }) diff --git a/docs/fiddles/features/keyboard-shortcuts/local/main.js b/docs/fiddles/features/keyboard-shortcuts/local/main.js index 6abd81b1be..6393f27a22 100644 --- a/docs/fiddles/features/keyboard-shortcuts/local/main.js +++ b/docs/fiddles/features/keyboard-shortcuts/local/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, Menu, MenuItem } = require('electron') +const { app, BrowserWindow, Menu, MenuItem } = require('electron/main') function createWindow () { const win = new BrowserWindow({ diff --git a/docs/fiddles/features/keyboard-shortcuts/web-apis/main.js b/docs/fiddles/features/keyboard-shortcuts/web-apis/main.js index 7803cd859d..cf335b4a84 100644 --- a/docs/fiddles/features/keyboard-shortcuts/web-apis/main.js +++ b/docs/fiddles/features/keyboard-shortcuts/web-apis/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') function createWindow () { // Create the browser window. diff --git a/docs/fiddles/features/macos-dock-menu/main.js b/docs/fiddles/features/macos-dock-menu/main.js index 7809e5459c..5b8b154fe4 100644 --- a/docs/fiddles/features/macos-dock-menu/main.js +++ b/docs/fiddles/features/macos-dock-menu/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, Menu } = require('electron') +const { app, BrowserWindow, Menu } = require('electron/main') function createWindow () { const win = new BrowserWindow({ diff --git a/docs/fiddles/features/notifications/main/main.js b/docs/fiddles/features/notifications/main/main.js index f6e6f867cc..b092c9a6ef 100644 --- a/docs/fiddles/features/notifications/main/main.js +++ b/docs/fiddles/features/notifications/main/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, Notification } = require('electron') +const { app, BrowserWindow, Notification } = require('electron/main') function createWindow () { const win = new BrowserWindow({ diff --git a/docs/fiddles/features/notifications/renderer/main.js b/docs/fiddles/features/notifications/renderer/main.js index e24a66dd52..9f26d370c6 100644 --- a/docs/fiddles/features/notifications/renderer/main.js +++ b/docs/fiddles/features/notifications/renderer/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') function createWindow () { const win = new BrowserWindow({ diff --git a/docs/fiddles/features/offscreen-rendering/main.js b/docs/fiddles/features/offscreen-rendering/main.js index daf4306b8c..6c64afb10f 100644 --- a/docs/fiddles/features/offscreen-rendering/main.js +++ b/docs/fiddles/features/offscreen-rendering/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') const fs = require('node:fs') const path = require('node:path') diff --git a/docs/fiddles/features/online-detection/main.js b/docs/fiddles/features/online-detection/main.js index 7bc42d7725..4e9a092cb1 100644 --- a/docs/fiddles/features/online-detection/main.js +++ b/docs/fiddles/features/online-detection/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') function createWindow () { const onlineStatusWindow = new BrowserWindow({ diff --git a/docs/fiddles/features/progress-bar/main.js b/docs/fiddles/features/progress-bar/main.js index c400638359..4bcc1f5536 100644 --- a/docs/fiddles/features/progress-bar/main.js +++ b/docs/fiddles/features/progress-bar/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') let progressInterval diff --git a/docs/fiddles/features/recent-documents/main.js b/docs/fiddles/features/recent-documents/main.js index 628f01f0e0..c4a399a78c 100644 --- a/docs/fiddles/features/recent-documents/main.js +++ b/docs/fiddles/features/recent-documents/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') const fs = require('node:fs') const path = require('node:path') diff --git a/docs/fiddles/features/represented-file/main.js b/docs/fiddles/features/represented-file/main.js index 9b107a09db..183b3fc3d1 100644 --- a/docs/fiddles/features/represented-file/main.js +++ b/docs/fiddles/features/represented-file/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') const os = require('node:os') function createWindow () { diff --git a/docs/fiddles/features/web-bluetooth/main.js b/docs/fiddles/features/web-bluetooth/main.js index 0821de287e..103c9891ba 100644 --- a/docs/fiddles/features/web-bluetooth/main.js +++ b/docs/fiddles/features/web-bluetooth/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, ipcMain } = require('electron') +const { app, BrowserWindow, ipcMain } = require('electron/main') const path = require('node:path') let bluetoothPinCallback diff --git a/docs/fiddles/features/web-bluetooth/preload.js b/docs/fiddles/features/web-bluetooth/preload.js index d10666b7ee..6800eaccd9 100644 --- a/docs/fiddles/features/web-bluetooth/preload.js +++ b/docs/fiddles/features/web-bluetooth/preload.js @@ -1,4 +1,4 @@ -const { contextBridge, ipcRenderer } = require('electron') +const { contextBridge, ipcRenderer } = require('electron/renderer') contextBridge.exposeInMainWorld('electronAPI', { cancelBluetoothRequest: (callback) => ipcRenderer.send('cancel-bluetooth-request', callback), diff --git a/docs/fiddles/features/web-hid/main.js b/docs/fiddles/features/web-hid/main.js index b5dcb5aea4..315c39da37 100644 --- a/docs/fiddles/features/web-hid/main.js +++ b/docs/fiddles/features/web-hid/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') function createWindow () { const mainWindow = new BrowserWindow({ diff --git a/docs/fiddles/features/web-serial/main.js b/docs/fiddles/features/web-serial/main.js index c894fc2e2f..1839f4f425 100644 --- a/docs/fiddles/features/web-serial/main.js +++ b/docs/fiddles/features/web-serial/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') function createWindow () { const mainWindow = new BrowserWindow({ diff --git a/docs/fiddles/features/web-usb/main.js b/docs/fiddles/features/web-usb/main.js index 4ebe41e36d..a60de9182a 100644 --- a/docs/fiddles/features/web-usb/main.js +++ b/docs/fiddles/features/web-usb/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') function createWindow () { const mainWindow = new BrowserWindow({ diff --git a/docs/fiddles/ipc/pattern-1/main.js b/docs/fiddles/ipc/pattern-1/main.js index c43937edab..43799d4cb0 100644 --- a/docs/fiddles/ipc/pattern-1/main.js +++ b/docs/fiddles/ipc/pattern-1/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, ipcMain } = require('electron') +const { app, BrowserWindow, ipcMain } = require('electron/main') const path = require('node:path') function createWindow () { diff --git a/docs/fiddles/ipc/pattern-1/preload.js b/docs/fiddles/ipc/pattern-1/preload.js index 50b3f3d4b1..ce23688245 100644 --- a/docs/fiddles/ipc/pattern-1/preload.js +++ b/docs/fiddles/ipc/pattern-1/preload.js @@ -1,4 +1,4 @@ -const { contextBridge, ipcRenderer } = require('electron') +const { contextBridge, ipcRenderer } = require('electron/renderer') contextBridge.exposeInMainWorld('electronAPI', { setTitle: (title) => ipcRenderer.send('set-title', title) diff --git a/docs/fiddles/ipc/pattern-2/main.js b/docs/fiddles/ipc/pattern-2/main.js index 187a6d83b5..369ddf6557 100644 --- a/docs/fiddles/ipc/pattern-2/main.js +++ b/docs/fiddles/ipc/pattern-2/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, ipcMain, dialog } = require('electron') +const { app, BrowserWindow, ipcMain, dialog } = require('electron/main') const path = require('node:path') async function handleFileOpen () { diff --git a/docs/fiddles/ipc/pattern-2/preload.js b/docs/fiddles/ipc/pattern-2/preload.js index 5f2f6e2205..32f4acd9da 100644 --- a/docs/fiddles/ipc/pattern-2/preload.js +++ b/docs/fiddles/ipc/pattern-2/preload.js @@ -1,4 +1,4 @@ -const { contextBridge, ipcRenderer } = require('electron') +const { contextBridge, ipcRenderer } = require('electron/renderer') contextBridge.exposeInMainWorld('electronAPI', { openFile: () => ipcRenderer.invoke('dialog:openFile') diff --git a/docs/fiddles/ipc/pattern-3/main.js b/docs/fiddles/ipc/pattern-3/main.js index 91c0c1a646..60e08ba80d 100644 --- a/docs/fiddles/ipc/pattern-3/main.js +++ b/docs/fiddles/ipc/pattern-3/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, Menu, ipcMain } = require('electron') +const { app, BrowserWindow, Menu, ipcMain } = require('electron/main') const path = require('node:path') function createWindow () { diff --git a/docs/fiddles/ipc/pattern-3/preload.js b/docs/fiddles/ipc/pattern-3/preload.js index ad4dd27f1f..0c0402e53f 100644 --- a/docs/fiddles/ipc/pattern-3/preload.js +++ b/docs/fiddles/ipc/pattern-3/preload.js @@ -1,4 +1,4 @@ -const { contextBridge, ipcRenderer } = require('electron') +const { contextBridge, ipcRenderer } = require('electron/renderer') contextBridge.exposeInMainWorld('electronAPI', { handleCounter: (callback) => ipcRenderer.on('update-counter', callback) diff --git a/docs/fiddles/ipc/webview-new-window/main.js b/docs/fiddles/ipc/webview-new-window/main.js index a76c1434c4..8b6aa41883 100644 --- a/docs/fiddles/ipc/webview-new-window/main.js +++ b/docs/fiddles/ipc/webview-new-window/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') const path = require('node:path') function createWindow () { diff --git a/docs/fiddles/ipc/webview-new-window/preload.js b/docs/fiddles/ipc/webview-new-window/preload.js index 5b5b6e70a6..99f3e6bc60 100644 --- a/docs/fiddles/ipc/webview-new-window/preload.js +++ b/docs/fiddles/ipc/webview-new-window/preload.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') const webview = document.getElementById('webview') ipcRenderer.on('webview-new-window', (e, webContentsId, details) => { console.log('webview-new-window', webContentsId, details) diff --git a/docs/fiddles/media/screenshot/take-screenshot/main.js b/docs/fiddles/media/screenshot/take-screenshot/main.js index cb09498a0d..73b8b97870 100644 --- a/docs/fiddles/media/screenshot/take-screenshot/main.js +++ b/docs/fiddles/media/screenshot/take-screenshot/main.js @@ -1,4 +1,4 @@ -const { BrowserWindow, app, screen, ipcMain, desktopCapturer } = require('electron') +const { BrowserWindow, app, screen, ipcMain, desktopCapturer } = require('electron/main') let mainWindow = null diff --git a/docs/fiddles/media/screenshot/take-screenshot/renderer.js b/docs/fiddles/media/screenshot/take-screenshot/renderer.js index fd615325b8..4712a2f0ea 100644 --- a/docs/fiddles/media/screenshot/take-screenshot/renderer.js +++ b/docs/fiddles/media/screenshot/take-screenshot/renderer.js @@ -1,4 +1,4 @@ -const { shell, ipcRenderer } = require('electron') +const { shell, ipcRenderer } = require('electron/renderer') const fs = require('node:fs').promises const os = require('node:os') diff --git a/docs/fiddles/menus/customize-menus/main.js b/docs/fiddles/menus/customize-menus/main.js index 74a7008954..63289526d9 100644 --- a/docs/fiddles/menus/customize-menus/main.js +++ b/docs/fiddles/menus/customize-menus/main.js @@ -6,8 +6,9 @@ const { ipcMain, app, shell, - dialog -} = require('electron') + dialog, + autoUpdater +} = require('electron/main') const menu = new Menu() menu.append(new MenuItem({ label: 'Hello' })) @@ -185,7 +186,7 @@ function addUpdateMenuItems (items, position) { visible: false, key: 'checkForUpdate', click: () => { - require('electron').autoUpdater.checkForUpdates() + autoUpdater.checkForUpdates() } }, { @@ -194,7 +195,7 @@ function addUpdateMenuItems (items, position) { visible: false, key: 'restartToUpdate', click: () => { - require('electron').autoUpdater.quitAndInstall() + autoUpdater.quitAndInstall() } } ] diff --git a/docs/fiddles/menus/customize-menus/renderer.js b/docs/fiddles/menus/customize-menus/renderer.js index 5527e1f200..372db5ce68 100644 --- a/docs/fiddles/menus/customize-menus/renderer.js +++ b/docs/fiddles/menus/customize-menus/renderer.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') // Tell main process to show the menu when demo button is clicked const contextMenuBtn = document.getElementById('context-menu') diff --git a/docs/fiddles/menus/shortcuts/main.js b/docs/fiddles/menus/shortcuts/main.js index ff51f59a9a..1b295eef49 100644 --- a/docs/fiddles/menus/shortcuts/main.js +++ b/docs/fiddles/menus/shortcuts/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, globalShortcut, dialog, shell } = require('electron') +const { app, BrowserWindow, globalShortcut, dialog, shell } = require('electron/main') // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. diff --git a/docs/fiddles/native-ui/dialogs/error-dialog/main.js b/docs/fiddles/native-ui/dialogs/error-dialog/main.js index 1e26daacd8..bfedd4a3be 100644 --- a/docs/fiddles/native-ui/dialogs/error-dialog/main.js +++ b/docs/fiddles/native-ui/dialogs/error-dialog/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron') +const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron/main') // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. diff --git a/docs/fiddles/native-ui/dialogs/error-dialog/renderer.js b/docs/fiddles/native-ui/dialogs/error-dialog/renderer.js index e355e7ee9a..0dff640bf8 100644 --- a/docs/fiddles/native-ui/dialogs/error-dialog/renderer.js +++ b/docs/fiddles/native-ui/dialogs/error-dialog/renderer.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') const errorBtn = document.getElementById('error-dialog') diff --git a/docs/fiddles/native-ui/dialogs/information-dialog/main.js b/docs/fiddles/native-ui/dialogs/information-dialog/main.js index 187abcfce7..bb0196e817 100644 --- a/docs/fiddles/native-ui/dialogs/information-dialog/main.js +++ b/docs/fiddles/native-ui/dialogs/information-dialog/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron') +const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron/main') // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. diff --git a/docs/fiddles/native-ui/dialogs/information-dialog/renderer.js b/docs/fiddles/native-ui/dialogs/information-dialog/renderer.js index 108d8e3241..f6fe51bac7 100644 --- a/docs/fiddles/native-ui/dialogs/information-dialog/renderer.js +++ b/docs/fiddles/native-ui/dialogs/information-dialog/renderer.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') const informationBtn = document.getElementById('information-dialog') diff --git a/docs/fiddles/native-ui/dialogs/open-file-or-directory/main.js b/docs/fiddles/native-ui/dialogs/open-file-or-directory/main.js index b3f87183a7..52ead02c9d 100644 --- a/docs/fiddles/native-ui/dialogs/open-file-or-directory/main.js +++ b/docs/fiddles/native-ui/dialogs/open-file-or-directory/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron') +const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron/main') // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. diff --git a/docs/fiddles/native-ui/dialogs/open-file-or-directory/renderer.js b/docs/fiddles/native-ui/dialogs/open-file-or-directory/renderer.js index 08333444dc..0c5efd6735 100644 --- a/docs/fiddles/native-ui/dialogs/open-file-or-directory/renderer.js +++ b/docs/fiddles/native-ui/dialogs/open-file-or-directory/renderer.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') const selectDirBtn = document.getElementById('select-directory') diff --git a/docs/fiddles/native-ui/dialogs/save-dialog/main.js b/docs/fiddles/native-ui/dialogs/save-dialog/main.js index b522f27ed6..d33fa33d32 100644 --- a/docs/fiddles/native-ui/dialogs/save-dialog/main.js +++ b/docs/fiddles/native-ui/dialogs/save-dialog/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron') +const { app, BrowserWindow, ipcMain, dialog, shell } = require('electron/main') // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. diff --git a/docs/fiddles/native-ui/dialogs/save-dialog/renderer.js b/docs/fiddles/native-ui/dialogs/save-dialog/renderer.js index 075b02e17b..ae06226891 100644 --- a/docs/fiddles/native-ui/dialogs/save-dialog/renderer.js +++ b/docs/fiddles/native-ui/dialogs/save-dialog/renderer.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') const saveBtn = document.getElementById('save-dialog') diff --git a/docs/fiddles/native-ui/drag-and-drop/main.js b/docs/fiddles/native-ui/drag-and-drop/main.js index 1137ef176a..2186de038c 100644 --- a/docs/fiddles/native-ui/drag-and-drop/main.js +++ b/docs/fiddles/native-ui/drag-and-drop/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, ipcMain, nativeImage, shell } = require('electron') +const { app, BrowserWindow, ipcMain, nativeImage, shell } = require('electron/main') // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. let mainWindow diff --git a/docs/fiddles/native-ui/drag-and-drop/renderer.js b/docs/fiddles/native-ui/drag-and-drop/renderer.js index 859348551e..48df46b460 100644 --- a/docs/fiddles/native-ui/drag-and-drop/renderer.js +++ b/docs/fiddles/native-ui/drag-and-drop/renderer.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') const dragFileLink = document.getElementById('drag-file-link') diff --git a/docs/fiddles/native-ui/external-links-file-manager/main.js b/docs/fiddles/native-ui/external-links-file-manager/main.js index a2de1b97c8..f3e3c0ec62 100644 --- a/docs/fiddles/native-ui/external-links-file-manager/main.js +++ b/docs/fiddles/native-ui/external-links-file-manager/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, shell } = require('electron') +const { app, BrowserWindow, shell } = require('electron/main') // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. diff --git a/docs/fiddles/native-ui/external-links-file-manager/renderer.js b/docs/fiddles/native-ui/external-links-file-manager/renderer.js index 2a059092c9..7bbea2ca1a 100644 --- a/docs/fiddles/native-ui/external-links-file-manager/renderer.js +++ b/docs/fiddles/native-ui/external-links-file-manager/renderer.js @@ -1,4 +1,4 @@ -const { shell } = require('electron') +const { shell } = require('electron/renderer') const os = require('node:os') const exLinksBtn = document.getElementById('open-ex-links') diff --git a/docs/fiddles/native-ui/notifications/main.js b/docs/fiddles/native-ui/notifications/main.js index a2de1b97c8..f3e3c0ec62 100644 --- a/docs/fiddles/native-ui/notifications/main.js +++ b/docs/fiddles/native-ui/notifications/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, shell } = require('electron') +const { app, BrowserWindow, shell } = require('electron/main') // Keep a global reference of the window object, if you don't, the window will // be closed automatically when the JavaScript object is garbage collected. diff --git a/docs/fiddles/native-ui/tray/main.js b/docs/fiddles/native-ui/tray/main.js index 3d5ce65e02..2a238a265c 100644 --- a/docs/fiddles/native-ui/tray/main.js +++ b/docs/fiddles/native-ui/tray/main.js @@ -1,4 +1,4 @@ -const { app, Tray, Menu, nativeImage } = require('electron') +const { app, Tray, Menu, nativeImage } = require('electron/main') let tray diff --git a/docs/fiddles/quick-start/main.js b/docs/fiddles/quick-start/main.js index 6fda959b7e..c614294e01 100644 --- a/docs/fiddles/quick-start/main.js +++ b/docs/fiddles/quick-start/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') const path = require('node:path') function createWindow () { diff --git a/docs/fiddles/screen/fit-screen/main.js b/docs/fiddles/screen/fit-screen/main.js index 559e0f24e4..9b1ffcbbe0 100644 --- a/docs/fiddles/screen/fit-screen/main.js +++ b/docs/fiddles/screen/fit-screen/main.js @@ -3,14 +3,11 @@ // For more info, see: // https://www.electronjs.org/docs/latest/api/screen -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow, screen } = require('electron/main') let mainWindow = null app.whenReady().then(() => { - // We cannot require the screen module until the app is ready. - const { screen } = require('electron') - // Create a window that fills the screen's available work area. const primaryDisplay = screen.getPrimaryDisplay() const { width, height } = primaryDisplay.workAreaSize diff --git a/docs/fiddles/system/clipboard/copy/main.js b/docs/fiddles/system/clipboard/copy/main.js index c68becbd8e..1c76f9d50a 100644 --- a/docs/fiddles/system/clipboard/copy/main.js +++ b/docs/fiddles/system/clipboard/copy/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, ipcMain, clipboard } = require('electron') +const { app, BrowserWindow, ipcMain, clipboard } = require('electron/main') const path = require('node:path') let mainWindow = null diff --git a/docs/fiddles/system/clipboard/copy/preload.js b/docs/fiddles/system/clipboard/copy/preload.js index f97bfe1fc2..580d386657 100644 --- a/docs/fiddles/system/clipboard/copy/preload.js +++ b/docs/fiddles/system/clipboard/copy/preload.js @@ -1,4 +1,4 @@ -const { contextBridge, ipcRenderer } = require('electron') +const { contextBridge, ipcRenderer } = require('electron/renderer') contextBridge.exposeInMainWorld('clipboard', { writeText: (text) => ipcRenderer.invoke('clipboard:writeText', text) diff --git a/docs/fiddles/system/clipboard/paste/main.js b/docs/fiddles/system/clipboard/paste/main.js index 43f73a14c8..58c2fbb3e8 100644 --- a/docs/fiddles/system/clipboard/paste/main.js +++ b/docs/fiddles/system/clipboard/paste/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, ipcMain, clipboard } = require('electron') +const { app, BrowserWindow, ipcMain, clipboard } = require('electron/main') const path = require('node:path') let mainWindow = null diff --git a/docs/fiddles/system/clipboard/paste/preload.js b/docs/fiddles/system/clipboard/paste/preload.js index 7ea394192e..31ce721451 100644 --- a/docs/fiddles/system/clipboard/paste/preload.js +++ b/docs/fiddles/system/clipboard/paste/preload.js @@ -1,4 +1,4 @@ -const { contextBridge, ipcRenderer } = require('electron') +const { contextBridge, ipcRenderer } = require('electron/renderer') contextBridge.exposeInMainWorld('clipboard', { readText: () => ipcRenderer.invoke('clipboard:readText'), diff --git a/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/main.js b/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/main.js index 6459985a17..84efd0cb97 100644 --- a/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/main.js +++ b/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, ipcMain, shell, dialog } = require('electron') +const { app, BrowserWindow, ipcMain, shell, dialog } = require('electron/main') const path = require('node:path') let mainWindow diff --git a/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/preload.js b/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/preload.js index 13e803ad9c..eda1d8c721 100644 --- a/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/preload.js +++ b/docs/fiddles/system/protocol-handler/launch-app-from-URL-in-another-app/preload.js @@ -1,11 +1,5 @@ -// All of the Node.js APIs are available in the preload process. -// It has the same sandbox as a Chrome extension. -const { contextBridge, ipcRenderer } = require('electron') +const { contextBridge, ipcRenderer } = require('electron/renderer') -// Set up context bridge between the renderer process and the main process -contextBridge.exposeInMainWorld( - 'shell', - { - open: () => ipcRenderer.send('shell:open') - } -) +contextBridge.exposeInMainWorld('shell', { + open: () => ipcRenderer.send('shell:open') +}) diff --git a/docs/fiddles/system/system-app-user-information/app-information/main.js b/docs/fiddles/system/system-app-user-information/app-information/main.js index bfbfcfac55..7ec2bd5d32 100644 --- a/docs/fiddles/system/system-app-user-information/app-information/main.js +++ b/docs/fiddles/system/system-app-user-information/app-information/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, ipcMain, shell } = require('electron') +const { app, BrowserWindow, ipcMain, shell } = require('electron/main') let mainWindow = null diff --git a/docs/fiddles/system/system-app-user-information/app-information/renderer.js b/docs/fiddles/system/system-app-user-information/app-information/renderer.js index e8a9b1b745..62705b3770 100644 --- a/docs/fiddles/system/system-app-user-information/app-information/renderer.js +++ b/docs/fiddles/system/system-app-user-information/app-information/renderer.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') const appInfoBtn = document.getElementById('app-info') diff --git a/docs/fiddles/system/system-information/get-version-information/main.js b/docs/fiddles/system/system-information/get-version-information/main.js index 34bdd9e32b..14ffef1acd 100644 --- a/docs/fiddles/system/system-information/get-version-information/main.js +++ b/docs/fiddles/system/system-information/get-version-information/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow, shell } = require('electron') +const { app, BrowserWindow, shell } = require('electron/main') let mainWindow = null diff --git a/docs/fiddles/tutorial-first-app/main.js b/docs/fiddles/tutorial-first-app/main.js index fdb092a9d4..8e92734f27 100644 --- a/docs/fiddles/tutorial-first-app/main.js +++ b/docs/fiddles/tutorial-first-app/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') const createWindow = () => { const win = new BrowserWindow({ diff --git a/docs/fiddles/tutorial-preload/main.js b/docs/fiddles/tutorial-preload/main.js index 32e5c10d42..f62f401355 100644 --- a/docs/fiddles/tutorial-preload/main.js +++ b/docs/fiddles/tutorial-preload/main.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow } = require('electron/main') const path = require('node:path') const createWindow = () => { diff --git a/docs/fiddles/tutorial-preload/preload.js b/docs/fiddles/tutorial-preload/preload.js index 4d0213eedb..561df488dc 100644 --- a/docs/fiddles/tutorial-preload/preload.js +++ b/docs/fiddles/tutorial-preload/preload.js @@ -1,4 +1,4 @@ -const { contextBridge } = require('electron') +const { contextBridge } = require('electron/renderer') contextBridge.exposeInMainWorld('versions', { node: () => process.versions.node, diff --git a/docs/fiddles/windows/manage-windows/frameless-window/main.js b/docs/fiddles/windows/manage-windows/frameless-window/main.js index b60f99d224..021679fc5e 100644 --- a/docs/fiddles/windows/manage-windows/frameless-window/main.js +++ b/docs/fiddles/windows/manage-windows/frameless-window/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, ipcMain, shell } = require('electron') +const { app, BrowserWindow, ipcMain, shell } = require('electron/main') ipcMain.on('create-frameless-window', (event, { url }) => { const win = new BrowserWindow({ frame: false }) diff --git a/docs/fiddles/windows/manage-windows/frameless-window/renderer.js b/docs/fiddles/windows/manage-windows/frameless-window/renderer.js index 21f91ad561..b8aafe29d1 100644 --- a/docs/fiddles/windows/manage-windows/frameless-window/renderer.js +++ b/docs/fiddles/windows/manage-windows/frameless-window/renderer.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') const newWindowBtn = document.getElementById('frameless-window') diff --git a/docs/fiddles/windows/manage-windows/manage-window-state/main.js b/docs/fiddles/windows/manage-windows/manage-window-state/main.js index 05fcdd704e..f41240b46f 100644 --- a/docs/fiddles/windows/manage-windows/manage-window-state/main.js +++ b/docs/fiddles/windows/manage-windows/manage-window-state/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, ipcMain, shell } = require('electron') +const { app, BrowserWindow, ipcMain, shell } = require('electron/main') ipcMain.on('create-demo-window', (event) => { const win = new BrowserWindow({ width: 400, height: 275 }) diff --git a/docs/fiddles/windows/manage-windows/manage-window-state/renderer.js b/docs/fiddles/windows/manage-windows/manage-window-state/renderer.js index bdf6a54c17..2efe3199a8 100644 --- a/docs/fiddles/windows/manage-windows/manage-window-state/renderer.js +++ b/docs/fiddles/windows/manage-windows/manage-window-state/renderer.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') const manageWindowBtn = document.getElementById('manage-window') diff --git a/docs/fiddles/windows/manage-windows/new-window/main.js b/docs/fiddles/windows/manage-windows/new-window/main.js index 4e4a4e0ad5..4e2f9c6beb 100644 --- a/docs/fiddles/windows/manage-windows/new-window/main.js +++ b/docs/fiddles/windows/manage-windows/new-window/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, ipcMain, shell } = require('electron') +const { app, BrowserWindow, ipcMain, shell } = require('electron/main') ipcMain.on('new-window', (event, { url, width, height }) => { const win = new BrowserWindow({ width, height }) diff --git a/docs/fiddles/windows/manage-windows/new-window/renderer.js b/docs/fiddles/windows/manage-windows/new-window/renderer.js index 0d80d2ee2c..ce4b7a4b51 100644 --- a/docs/fiddles/windows/manage-windows/new-window/renderer.js +++ b/docs/fiddles/windows/manage-windows/new-window/renderer.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') const newWindowBtn = document.getElementById('new-window') diff --git a/docs/fiddles/windows/manage-windows/window-events/main.js b/docs/fiddles/windows/manage-windows/window-events/main.js index 5abf2cc257..a7fd20cc92 100644 --- a/docs/fiddles/windows/manage-windows/window-events/main.js +++ b/docs/fiddles/windows/manage-windows/window-events/main.js @@ -1,5 +1,5 @@ // Modules to control application life and create native browser window -const { app, BrowserWindow, ipcMain, shell } = require('electron') +const { app, BrowserWindow, ipcMain, shell } = require('electron/main') function createWindow () { // Create the browser window. diff --git a/docs/fiddles/windows/manage-windows/window-events/renderer.js b/docs/fiddles/windows/manage-windows/window-events/renderer.js index 85460df937..99f9909526 100644 --- a/docs/fiddles/windows/manage-windows/window-events/renderer.js +++ b/docs/fiddles/windows/manage-windows/window-events/renderer.js @@ -1,4 +1,4 @@ -const { ipcRenderer } = require('electron') +const { ipcRenderer } = require('electron/renderer') const listenToWindowBtn = document.getElementById('listen-to-window') const focusModalBtn = document.getElementById('focus-on-modal-window')