electron-debug
Advanced tools
Comparing version 3.0.1 to 3.1.0
16
index.js
'use strict'; | ||
const {app, BrowserWindow} = require('electron'); | ||
const {app, BrowserWindow, session} = require('electron'); | ||
const localShortcut = require('electron-localshortcut'); | ||
@@ -57,2 +57,8 @@ const isDev = require('electron-is-dev'); | ||
const isExtensionInstalled = name => { | ||
// For Electron >=9. | ||
if (session.defaultSession.getAllExtensions) { | ||
return {}.hasOwnProperty.call(session.defaultSession.getAllExtensions(), name); | ||
} | ||
// TODO: Remove this when targeting Electron >=9. | ||
return BrowserWindow.getDevToolsExtensions && | ||
@@ -64,3 +70,9 @@ {}.hasOwnProperty.call(BrowserWindow.getDevToolsExtensions(), name); | ||
if (!isExtensionInstalled(name)) { | ||
BrowserWindow.addDevToolsExtension(getPath(name)); | ||
// For Electron >=9. | ||
if (session.defaultSession.loadExtension) { | ||
session.defaultSession.loadExtension(getPath(name)); | ||
} else { | ||
// TODO: Remove this when targeting Electron >=9. | ||
BrowserWindow.addDevToolsExtension(getPath(name)); | ||
} | ||
} | ||
@@ -67,0 +79,0 @@ } catch (_) {} |
{ | ||
"name": "electron-debug", | ||
"version": "3.0.1", | ||
"version": "3.1.0", | ||
"description": "Adds useful debug features to your Electron app", | ||
"license": "MIT", | ||
"repository": "sindresorhus/electron-debug", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
@@ -12,0 +13,0 @@ "scripts": { |
@@ -5,3 +5,2 @@ # electron-debug | ||
## Features | ||
@@ -40,3 +39,2 @@ | ||
## Install | ||
@@ -50,3 +48,2 @@ | ||
## Usage | ||
@@ -67,3 +64,2 @@ | ||
## API | ||
@@ -73,3 +69,3 @@ | ||
### electronDebug([options]) | ||
### electronDebug(options?) | ||
@@ -88,3 +84,3 @@ Install keyboard shortcuts and optionally activate DevTools on each created `BrowserWindow`. | ||
Type: `boolean`<br> | ||
Type: `boolean`\ | ||
Default: `true` | ||
@@ -96,4 +92,4 @@ | ||
Type: `string`<br> | ||
Default: `'previous'`<br> | ||
Type: `string`\ | ||
Default: `'previous'`\ | ||
Values: `'undocked'` `'right'` `'bottom'` `'previous'` `'detach'` | ||
@@ -103,3 +99,3 @@ | ||
### devTools([window]) | ||
### devTools(window?) | ||
@@ -110,6 +106,6 @@ Toggle DevTools for the specified `BrowserWindow` instance or the focused one. | ||
Type: `BrowserWindow`<br> | ||
Type: `BrowserWindow`\ | ||
Default: The focused `BrowserWindow` | ||
### refresh([window]) | ||
### refresh(window?) | ||
@@ -120,3 +116,3 @@ Reload the specified `BrowserWindow` instance or the focused one. | ||
Type: `BrowserWindow`<br> | ||
Type: `BrowserWindow`\ | ||
Default: The focused `BrowserWindow` | ||
@@ -130,6 +126,5 @@ | ||
Type: `BrowserWindow`<br> | ||
Type: `BrowserWindow`\ | ||
Default: The focused `BrowserWindow` | ||
## Related | ||
@@ -136,0 +131,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10232
159
129