diff --git a/docs/fiddles/features/dark-mode/main.js b/docs/fiddles/features/dark-mode/main.js index f28419afd54fd..00a343c8ac182 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 3def9e06ed8ea..752d9d71a0a57 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 9ee443196158e..0cf045a7c9b82 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 7e698ebb54ff2..3c02ab61c1eb5 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 8b43433a4a4e5..991c70d25f630 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 80e4012c812d1..62df976ea79e3 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 6abd81b1be372..6393f27a22f62 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 7803cd859db55..cf335b4a8433f 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 7809e5459c605..5b8b154fe4a8f 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 f6e6f867ccc88..b092c9a6ef4e8 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 e24a66dd52b8f..9f26d370c6ef3 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 daf4306b8c57f..6c64afb10f654 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 7bc42d7725670..4e9a092cb13f2 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 c400638359011..4bcc1f55361f9 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 628f01f0e016f..c4a399a78cdcd 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 9b107a09db0b9..183b3fc3d169c 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 0821de287e18b..103c9891ba9e5 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 d10666b7ee230..6800eaccd9ff5 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 b5dcb5aea414a..315c39da37d0c 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 c894fc2e2f07e..1839f4f425446 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 4ebe41e36dc28..a60de9182ada9 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 c43937edab60f..43799d4cb0b0c 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 50b3f3d4b1e41..ce23688245237 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 187a6d83b5d25..369ddf655787d 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 5f2f6e2205539..32f4acd9da499 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 91c0c1a64666e..60e08ba80d443 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 ad4dd27f1f9b2..0c0402e53f890 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 a76c1434c49a1..8b6aa41883c8a 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 5b5b6e70a6265..99f3e6bc60f49 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 cb09498a0d44a..73b8b97870a36 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 fd615325b8f3b..4712a2f0ea76b 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 74a700895481f..63289526d9389 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 5527e1f20008d..372db5ce68c70 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 ff51f59a9adab..1b295eef49ef6 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 1e26daacd8d83..bfedd4a3be71d 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 e355e7ee9a905..0dff640bf83ff 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 187abcfce7b15..bb0196e8179b0 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 108d8e3241023..f6fe51bac71f9 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 b3f87183a7f89..52ead02c9d081 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 08333444dca38..0c5efd6735dcd 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 b522f27ed6bab..d33fa33d32758 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 075b02e17b595..ae06226891c07 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 1137ef176a967..2186de038cca4 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 859348551e762..48df46b4601bb 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 a2de1b97c8972..f3e3c0ec62756 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 2a059092c98f1..7bbea2ca1a158 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 a2de1b97c8972..f3e3c0ec62756 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 3d5ce65e02a43..2a238a265c4c0 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 6fda959b7ee45..c614294e01db3 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 559e0f24e436e..9b1ffcbbe0c10 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 c68becbd8e986..1c76f9d50acf5 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 f97bfe1fc2e6b..580d3866576a6 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 43f73a14c8802..58c2fbb3e88c8 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 7ea394192ebd3..31ce721451d61 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 6459985a1730a..84efd0cb9748a 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 13e803ad9cf2b..eda1d8c721844 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 bfbfcfac553bd..7ec2bd5d32a21 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 e8a9b1b745d20..62705b3770822 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 34bdd9e32b3bc..14ffef1acd007 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 fdb092a9d4fcb..8e92734f271ee 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 32e5c10d4257c..f62f401355d11 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 4d0213eedb8e7..561df488dce66 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 b60f99d224903..021679fc5e2d0 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 21f91ad561b37..b8aafe29d183f 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 05fcdd704e167..f41240b46fae3 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 bdf6a54c17950..2efe3199a8314 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 4e4a4e0ad59a2..4e2f9c6bebb9b 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 0d80d2ee2c528..ce4b7a4b51a37 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 5abf2cc257ccb..a7fd20cc921f2 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 85460df9373ba..99f9909526059 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')