-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor TypeScript definition to CommonJS compatible export (#72)
- Loading branch information
1 parent
dd55906
commit 3c66c18
Showing
4 changed files
with
86 additions
and
64 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 |
---|---|---|
@@ -1,61 +1,76 @@ | ||
import {BrowserWindow} from 'electron'; | ||
|
||
export interface Options { | ||
declare namespace electronDebug { | ||
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'; | ||
} | ||
} | ||
|
||
declare const electronDebug: { | ||
/** | ||
Install keyboard shortcuts and optionally activate DevTools on each created `BrowserWindow`. | ||
@example | ||
``` | ||
import {app, BrowserWindow} from 'electron'; | ||
import electronDebug = require('electron-debug'); | ||
electronDebug(); | ||
let win; | ||
(async () => { | ||
await app.whenReady(); | ||
win = new BrowserWindow(); | ||
}); | ||
``` | ||
*/ | ||
(options?: electronDebug.Options): void; | ||
|
||
/** | ||
* Default: [Only in development](https://github.com/sindresorhus/electron-is-dev) | ||
*/ | ||
readonly enabled?: boolean; | ||
Reload the specified `BrowserWindow` instance or the focused one. | ||
@param window - Default: `BrowserWindow.getFocusedWindow()` | ||
*/ | ||
refresh(window?: BrowserWindow): void; | ||
|
||
/** | ||
* Show DevTools on each created `BrowserWindow`. | ||
* | ||
* @default true | ||
*/ | ||
readonly showDevTools?: boolean; | ||
Toggle DevTools for the specified `BrowserWindow` instance or the focused one. | ||
@param window - Default: `BrowserWindow.getFocusedWindow()` | ||
*/ | ||
devTools(window?: BrowserWindow): void; | ||
|
||
/** | ||
* The dock state to open DevTools in. | ||
* | ||
* @default 'undocked' | ||
*/ | ||
readonly devToolsMode?: 'undocked' | 'right' | 'bottom' | 'previous' | 'detach'; | ||
} | ||
Open DevTools for the specified `BrowserWindow` instance or the focused one. | ||
@param window - Default: `BrowserWindow.getFocusedWindow()` | ||
*/ | ||
openDevTools(window?: BrowserWindow): void; | ||
|
||
// TODO: Remove this for the next major release | ||
default: typeof electronDebug; | ||
}; | ||
|
||
/** | ||
* 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. | ||
* | ||
* @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 devTools(window?: BrowserWindow): void; | ||
|
||
/** | ||
* Open DevTools for the specified `BrowserWindow` instance or the focused one. | ||
* | ||
* @param window - Default: `BrowserWindow.getFocusedWindow()` | ||
*/ | ||
export function openDevTools(window?: BrowserWindow): void; | ||
export = electronDebug; |
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
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