Merge pull request #11836 from kaylieEB/master

Replace custom function with Object.values()
This commit is contained in:
Samuel Attard 2018-02-06 15:45:02 +11:00 committed by GitHub
commit 8c2c7c3634
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,11 +7,6 @@ const fs = require('fs')
const path = require('path')
const url = require('url')
// TODO(zcbenz): Remove this when we have Object.values().
const objectValues = function (object) {
return Object.keys(object).map(function (key) { return object[key] })
}
// Mapping between extensionId(hostname) and manifest.
const manifestMap = {} // extensionId => manifest
const manifestNameMap = {} // name => manifest
@ -110,7 +105,7 @@ const removeBackgroundPages = function (manifest) {
}
const sendToBackgroundPages = function (...args) {
for (const page of objectValues(backgroundPages)) {
for (const page of Object.values(backgroundPages)) {
page.webContents.sendToAll(...args)
}
}
@ -297,7 +292,7 @@ app.on('web-contents-created', function (event, webContents) {
hookWebContentsEvents(webContents)
webContents.on('devtools-opened', function () {
loadDevToolsExtensions(webContents, objectValues(manifestMap))
loadDevToolsExtensions(webContents, Object.values(manifestMap))
})
})