Socket
Socket
Sign inDemoInstall

electron-debug

Package Overview
Dependencies
1
Maintainers
1
Versions
29
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.2 to 0.4.0

42

index.js

@@ -7,4 +7,4 @@ 'use strict';

function devTools() {
const win = BrowserWindow.getFocusedWindow();
function devTools(win) {
win = win || BrowserWindow.getFocusedWindow();

@@ -24,29 +24,9 @@ if (win) {

function activateDebugContextMenu(e) {
const webContents = e.sender;
webContents.executeJavaScript(`window.__electron_debug.require('${__dirname}/context-menu').install();`);
}
module.exports = opts => {
opts = opts || {};
function deactivateDebugContextMenu(e) {
const webContents = e.sender;
webContents.executeJavaScript(`window.__electron_debug.require('${__dirname}/context-menu').uninstall();`);
}
function installDebugContextMenu(win) {
win.webContents.on('devtools-opened', activateDebugContextMenu);
win.webContents.on('devtools-closed', deactivateDebugContextMenu);
if (win.webContents.isDevToolsOpened()) {
activateDebugContextMenu({sender: win.webContents});
}
}
function uninstallDebugContextMenu(win) {
win.webContents.removeListener('devtools-opened', activateDebugContextMenu);
win.webContents.removeListener('devtools-closed', deactivateDebugContextMenu);
}
module.exports = () => {
app.on('browser-window-created', (e, win) => {
win.webContents.executeJavaScript('window.__electron_debug = {require: window.require};');
if (opts.showDevTools) {
devTools(win);
}
});

@@ -61,10 +41,2 @@

});
app.on('browser-window-focus', (e, win) => {
installDebugContextMenu(win);
});
app.on('browser-window-blur', (e, win) => {
uninstallDebugContextMenu(win);
});
};

13

package.json
{
"name": "electron-debug",
"version": "0.3.2",
"version": "0.4.0",
"description": "Adds useful debug features to your Electron app",

@@ -12,5 +12,2 @@ "license": "MIT",

},
"engines": {
"node": ">=0.12.0"
},
"scripts": {

@@ -31,4 +28,7 @@ "start": "electron test.js",

],
"dependencies": {
"electron-localshortcut": "^0.3.2"
},
"devDependencies": {
"electron-prebuilt": "^0.34.1",
"electron-prebuilt": "^0.34.3",
"xo": "*"

@@ -42,6 +42,3 @@ },

]
},
"dependencies": {
"electron-localshortcut": "^0.3.0"
}
}

@@ -10,5 +10,5 @@ # electron-debug

### Dev Tools
### DevTools
Toggle Dev Tools.
Toggle DevTools.

@@ -27,7 +27,3 @@ - OS X: <kbd>Cmd</kbd> <kbd>Alt</kbd> <kbd>I</kbd> or <kbd>F12</kbd>

### Inspect element
Right-click on an HTML element when DevTools is open to inspect it.
## Install

@@ -43,9 +39,11 @@

```js
var app = require('app');
const app = require('app');
require('electron-debug')();
require('electron-debug')({
showDevTools: true
});
let win;
app.on('ready', function () {
app.on('ready', () => {
win = new BrowserWindow({

@@ -58,5 +56,19 @@ width: 800,

### Options
#### showDevTools
Type: `boolean`
Default: `false`
Show DevTools on startup.
## Related
- [debug-menu](https://github.com/parro-it/debug-menu) - Chrome-like debug context-menu for Electron
## License
MIT © [Sindre Sorhus](http://sindresorhus.com)
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc