electron-debug
Adds useful debug features to your Electron app
Last updated a month ago by sindresorhus .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install electron-debug 
SYNC missed versions from official npm registry.

electron-debug

Adds useful debug features to your Electron app

Features

DevTools

Toggle DevTools.

  • macOS: <kbd>Cmd</kbd> <kbd>Alt</kbd> <kbd>I</kbd> or <kbd>F12</kbd>
  • Linux: <kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>I</kbd> or <kbd>F12</kbd>
  • Windows: <kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>I</kbd> or <kbd>F12</kbd>

Reload

Force reload the window.

  • macOS: <kbd>Cmd</kbd> <kbd>R</kbd> or <kbd>F5</kbd>
  • Linux: <kbd>Ctrl</kbd> <kbd>R</kbd> or <kbd>F5</kbd>
  • Windows: <kbd>Ctrl</kbd> <kbd>R</kbd> or <kbd>F5</kbd>

Element Inspector

Open DevTools and focus the Element Inspector tool.

  • macOS: <kbd>Cmd</kbd> <kbd>Shift</kbd> <kbd>C</kbd>
  • Linux: <kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>C</kbd>
  • Windows: <kbd>Ctrl</kbd> <kbd>Shift</kbd> <kbd>C</kbd>

Activates DevTools extensions

Just install any of these extension and they'll be activated for you:

Install

$ npm install electron-debug

Requires Electron 5 or later.

Usage

const {app, BrowserWindow} = require('electron');
const debug = require('electron-debug');

debug();

let mainWindow;
(async () => {
	await app.whenReady();
	mainWindow = new BrowserWindow();
})();

API

Only runs when in development, unless overridden by the isEnabled option. So no need to guard it for production.

electronDebug(options?)

Install keyboard shortcuts and optionally activate DevTools on each created BrowserWindow.

options

Type: object

isEnabled

Type: boolean

showDevTools

Type: boolean
Default: true

Show DevTools on each created BrowserWindow.

devToolsMode

Type: string
Default: 'previous'
Values: 'undocked' 'right' 'bottom' 'previous' 'detach'

The dock state to open DevTools in.

devTools(window?)

Toggle DevTools for the specified BrowserWindow instance or the focused one.

window

Type: BrowserWindow
Default: The focused BrowserWindow

refresh(window?)

Reload the specified BrowserWindow instance or the focused one.

window

Type: BrowserWindow
Default: The focused BrowserWindow

openDevTools([window])

Open DevTools for the specified BrowserWindow instance or the focused one.

window

Type: BrowserWindow
Default: The focused BrowserWindow

preloadScriptPath

Type: string

The absolute path to a preload script to use in session#setPreloads().

Use it to enable devtron even when nodeIntegration is turned off.

Related

Current Tags

  • 3.2.0                                ...           latest (a month ago)

28 Versions

  • 3.2.0                                ...           a month ago
  • 3.1.0                                ...           8 months ago
  • 3.0.1                                ...           2 years ago
  • 3.0.0                                ...           2 years ago
  • 2.2.0                                ...           2 years ago
  • 2.1.0                                ...           2 years ago
  • 2.0.0                                ...           3 years ago
  • 1.5.0                                ...           3 years ago
  • 1.4.0                                ...           3 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.0                                ...           4 years ago
  • 1.1.0                                ...           4 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
  • 0.7.0                                ...           5 years ago
  • 0.6.0                                ...           5 years ago
  • 0.5.2                                ...           5 years ago
  • 0.5.1                                ...           5 years ago
  • 0.5.0                                ...           5 years ago
  • 0.4.1                                ...           5 years ago
  • 0.4.0                                ...           5 years ago
  • 0.3.2                                ...           5 years ago
  • 0.3.1                                ...           5 years ago
  • 0.3.0                                ...           5 years ago
  • 0.2.1                                ...           5 years ago
  • 0.2.0                                ...           5 years ago
  • 0.1.1                                ...           6 years ago
  • 0.1.0                                ...           6 years ago
Maintainers (1)
Downloads
Today 18
This Week 1,154
This Month 8,584
Last Day 378
Last Week 2,454
Last Month 9,289
Dependencies (2)
Dev Dependencies (6)
Dependents (163)

Copyright 2014 - 2017 © taobao.org |