Add getDevToolsExtensions API
This commit is contained in:
parent
091682a039
commit
1f245d5ff6
2 changed files with 9 additions and 4 deletions
|
@ -340,7 +340,12 @@ app.once('ready', function () {
|
|||
delete manifestNameMap[name]
|
||||
}
|
||||
|
||||
BrowserWindow.isDevToolsExtensionInstalled = function (name) {
|
||||
return manifestNameMap.hasOwnProperty(name)
|
||||
BrowserWindow.getDevToolsExtensions = function () {
|
||||
const extensions = {}
|
||||
Object.keys(manifestNameMap).forEach(function (name) {
|
||||
const manifest = manifestNameMap[name]
|
||||
extensions[name] = {name: manifest.name, version: manifest.version}
|
||||
})
|
||||
return extensions
|
||||
}
|
||||
})
|
||||
|
|
|
@ -838,11 +838,11 @@ describe('browser-window module', function () {
|
|||
|
||||
beforeEach(function () {
|
||||
BrowserWindow.removeDevToolsExtension('foo')
|
||||
assert.equal(BrowserWindow.isDevToolsExtensionInstalled('foo'), false)
|
||||
assert.equal(BrowserWindow.getDevToolsExtensions().hasOwnProperty('foo'), false)
|
||||
|
||||
var extensionPath = path.join(__dirname, 'fixtures', 'devtools-extensions', 'foo')
|
||||
BrowserWindow.addDevToolsExtension(extensionPath)
|
||||
assert.equal(BrowserWindow.isDevToolsExtensionInstalled('foo'), true)
|
||||
assert.equal(BrowserWindow.getDevToolsExtensions().hasOwnProperty('foo'), true)
|
||||
|
||||
w.webContents.on('devtools-opened', function () {
|
||||
var showPanelIntevalId = setInterval(function () {
|
||||
|
|
Loading…
Reference in a new issue