File tree Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Expand file tree Collapse file tree 4 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,13 @@ declare const electronDebug: {
6868 @param window - Default: `BrowserWindow.getFocusedWindow()`
6969 */
7070 openDevTools ( window ?: BrowserWindow ) : void ;
71+
72+ /**
73+ The absolute path to a preload script to use in [`session#setPreloads()`](https://www.electronjs.org/docs/api/session#sessetpreloadspreloads).
74+
75+ Use it to enable `devtron` even when [`nodeIntegration`](https://www.electronjs.org/docs/api/browser-window#new-browserwindowoptions) is turned off.
76+ */
77+ preloadScriptPath : string ;
7178} ;
7279
7380export = electronDebug ;
Original file line number Diff line number Diff line change 11'use strict' ;
22const { app, BrowserWindow, session} = require ( 'electron' ) ;
3+ const path = require ( 'path' ) ;
34const localShortcut = require ( 'electron-localshortcut' ) ;
45const isDev = require ( 'electron-is-dev' ) ;
56
@@ -120,3 +121,4 @@ module.exports = options => {
120121module . exports . refresh = refresh ;
121122module . exports . devTools = devTools ;
122123module . exports . openDevTools = openDevTools ;
124+ module . exports . preloadScriptPath = path . join ( __dirname , 'preload.js' ) ;
Original file line number Diff line number Diff line change 1+ window . __devtron = { require, process} ;
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ Open DevTools and focus the Element Inspector tool.
3333Just install any of these extension and they'll be activated for you:
3434
3535- [ devtron] ( https://electronjs.org/devtron ) - The official Electron DevTools extension
36+ - You need to use [`preloadScriptPath`](#preloadScriptPath) if the `BrowserWindow`'s `nodeIntegration` is off.
3637- [ electron-react-devtools] ( https://github.com/firejune/electron-react-devtools ) - React DevTools extension for Electron
3738
3839## Install
@@ -116,6 +117,14 @@ Open DevTools for the specified `BrowserWindow` instance or the focused one.
116117Type: ` BrowserWindow ` \
117118Default: The focused ` BrowserWindow `
118119
120+ ### preloadScriptPath
121+
122+ Type: ` string `
123+
124+ The absolute path to a preload script to use in [ ` session#setPreloads() ` ] ( https://www.electronjs.org/docs/api/session#sessetpreloadspreloads ) .
125+
126+ Use it to enable ` devtron ` even when [ ` nodeIntegration ` ] ( https://www.electronjs.org/docs/api/browser-window#new-browserwindowoptions ) is turned off.
127+
119128## Related
120129
121130- [ electron-util] ( https://github.com/sindresorhus/electron-util ) - Useful utilities for developing Electron apps and modules
You can’t perform that action at this time.
0 commit comments