-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
865b0d7
commit c98a3d2
Showing
9 changed files
with
101 additions
and
179 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,80 +1,67 @@ | ||
import {BrowserWindow} from 'electron'; | ||
import {type BrowserWindow} from 'electron'; | ||
|
||
declare namespace electronDebug { | ||
interface Options { | ||
/** | ||
Default: [Only in development](https://github.com/sindresorhus/electron-is-dev) | ||
*/ | ||
readonly isEnabled?: boolean; | ||
|
||
/** | ||
Show DevTools on each created `BrowserWindow`. | ||
@default true | ||
*/ | ||
readonly showDevTools?: boolean; | ||
|
||
/** | ||
The dock state to open DevTools in. | ||
@default 'previous' | ||
*/ | ||
readonly devToolsMode?: | ||
| 'undocked' | ||
| 'right' | ||
| 'bottom' | ||
| 'previous' | ||
| 'detach'; | ||
} | ||
} | ||
|
||
declare const electronDebug: { | ||
export type Options = { | ||
/** | ||
Install keyboard shortcuts and optionally activate DevTools on each created `BrowserWindow`. | ||
@example | ||
``` | ||
import {app, BrowserWindow} from 'electron'; | ||
import debug = require('electron-debug'); | ||
debug(); | ||
let mainWindow; | ||
(async () => { | ||
await app.whenReady(); | ||
mainWindow = new BrowserWindow(); | ||
}); | ||
``` | ||
Default: [Only in development](https://github.com/sindresorhus/electron-is-dev) | ||
*/ | ||
(options?: electronDebug.Options): void; | ||
readonly isEnabled?: boolean; | ||
|
||
/** | ||
Reload the specified `BrowserWindow` instance or the focused one. | ||
Show DevTools on each created `BrowserWindow`. | ||
@param window - Default: `BrowserWindow.getFocusedWindow()` | ||
@default true | ||
*/ | ||
refresh(window?: BrowserWindow): void; | ||
readonly showDevTools?: boolean; | ||
|
||
/** | ||
Toggle DevTools for the specified `BrowserWindow` instance or the focused one. | ||
The dock state to open DevTools in. | ||
@param window - Default: `BrowserWindow.getFocusedWindow()` | ||
@default 'previous' | ||
*/ | ||
devTools(window?: BrowserWindow): void; | ||
readonly devToolsMode?: | ||
| 'undocked' | ||
| 'right' | ||
| 'bottom' | ||
| 'previous' | ||
| 'detach'; | ||
}; | ||
|
||
/** | ||
Open DevTools for the specified `BrowserWindow` instance or the focused one. | ||
/** | ||
Install keyboard shortcuts and optionally activate DevTools on each created `BrowserWindow`. | ||
@param window - Default: `BrowserWindow.getFocusedWindow()` | ||
*/ | ||
openDevTools(window?: BrowserWindow): void; | ||
@example | ||
``` | ||
import {app, BrowserWindow} from 'electron'; | ||
import debug from 'electron-debug'; | ||
/** | ||
The absolute path to a preload script to use in [`session#setPreloads()`](https://www.electronjs.org/docs/api/session#sessetpreloadspreloads). | ||
debug(); | ||
Use it to enable `devtron` even when [`nodeIntegration`](https://www.electronjs.org/docs/api/browser-window#new-browserwindowoptions) is turned off. | ||
*/ | ||
preloadScriptPath: string; | ||
}; | ||
let mainWindow; | ||
(async () => { | ||
await app.whenReady(); | ||
mainWindow = new BrowserWindow(); | ||
}); | ||
``` | ||
*/ | ||
export default function debug(options?: Options): void; | ||
|
||
/** | ||
Reload the specified `BrowserWindow` instance or the focused one. | ||
@param window - Default: `BrowserWindow.getFocusedWindow()` | ||
*/ | ||
export function refresh(window?: BrowserWindow): void; | ||
|
||
/** | ||
Toggle DevTools for the specified `BrowserWindow` instance or the focused one. | ||
@param window - Default: `BrowserWindow.getFocusedWindow()` | ||
*/ | ||
export function developmentTools(window?: BrowserWindow): void; | ||
|
||
/** | ||
Open DevTools for the specified `BrowserWindow` instance or the focused one. | ||
export = electronDebug; | ||
@param window - Default: `BrowserWindow.getFocusedWindow()` | ||
*/ | ||
export function openDevelopmentTools(window?: BrowserWindow): void; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,14 +10,22 @@ | |
"email": "[email protected]", | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": { | ||
"types": "./index.d.ts", | ||
"default": "./index.js" | ||
}, | ||
"sideEffects": false, | ||
"engines": { | ||
"node": ">=18" | ||
}, | ||
"scripts": { | ||
"start": "electron test.js", | ||
"test": "xo && tsd" | ||
"test": "xo" | ||
}, | ||
"files": [ | ||
"index.js", | ||
"index.d.ts", | ||
"preload.js" | ||
"index.d.ts" | ||
], | ||
"keywords": [ | ||
"electron", | ||
|
@@ -29,16 +37,14 @@ | |
"development" | ||
], | ||
"dependencies": { | ||
"electron-is-dev": "^1.1.0", | ||
"electron-localshortcut": "^3.1.0" | ||
"electron-is-dev": "^3.0.1", | ||
"electron-localshortcut": "^3.2.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^12.0.0", | ||
"devtron": "^1.4.0", | ||
"electron": "^5.0.1", | ||
"@types/node": "^20.12.7", | ||
"electron": "^30.0.1", | ||
"electron-react-devtools": "^0.5.3", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
"xo": "^0.58.0" | ||
}, | ||
"xo": { | ||
"envs": [ | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.