-
-
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
2ee4ef0
commit a1ac261
Showing
5 changed files
with
74 additions
and
3 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import {BrowserWindow} from 'electron'; | ||
|
||
export interface Options { | ||
/** | ||
* Default: [Only in development](https://github.com/sindresorhus/electron-is-dev) | ||
*/ | ||
readonly enabled?: boolean; | ||
|
||
/** | ||
* Show DevTools on each created `BrowserWindow`. | ||
* | ||
* @default true | ||
*/ | ||
readonly showDevTools?: boolean; | ||
|
||
/** | ||
* The dock state to open DevTools in. | ||
* | ||
* @default 'undocked' | ||
*/ | ||
readonly devToolsMode?: 'undocked' | 'right' | 'bottom' | 'previous' | 'detach'; | ||
} | ||
|
||
/** | ||
* Install keyboard shortcuts and optionally activate DevTools on each created `BrowserWindow`. | ||
* | ||
* @example | ||
* | ||
* import {app, BrowserWindow} from 'electron'; | ||
* import electronDebug from 'electron-debug'; | ||
* | ||
* electronDebug(); | ||
* | ||
* let win; | ||
* (async () => { | ||
* await app.whenReady(); | ||
* win = new BrowserWindow(); | ||
* }); | ||
*/ | ||
export default function electronDebug(options?: Options): void; | ||
|
||
/** | ||
* Reload the specified `BrowserWindow` instance or the focused one. | ||
*/ | ||
export function refresh(window?: BrowserWindow = BrowserWindow.getFocusedWindow()): void; | ||
|
||
/** | ||
* Toggle DevTools for the specified `BrowserWindow` instance or the focused one. | ||
*/ | ||
export function devTools(window?: BrowserWindow = BrowserWindow.getFocusedWindow()): void; | ||
|
||
/** | ||
* Open DevTools for the specified `BrowserWindow` instance or the focused one. | ||
*/ | ||
export function openDevTools(window?: BrowserWindow = BrowserWindow.getFocusedWindow()): 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 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 |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import {expectType} from 'tsd-check'; | ||
import {BrowserWindow} from 'electron'; | ||
import electronDebug, {refresh, devTools, openDevTools} from '.'; | ||
|
||
expectType<void>(electronDebug({ | ||
enabled: true, | ||
showDevTools: true | ||
})); | ||
|
||
expectType<void>(refresh(new BrowserWindow())); | ||
expectType<void>(devTools()); | ||
expectType<void>(openDevTools()); |
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