Browse Source

Replace custom function with Object.values()

kaylie 7 years ago
parent
commit
3c64062f69
1 changed files with 2 additions and 7 deletions
  1. 2 7
      lib/browser/chrome-extension.js

+ 2 - 7
lib/browser/chrome-extension.js

@@ -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))
   })
 })