From a7badd43d537e5310ef65ea87c26a89236313e1f Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 14 Jul 2016 08:59:49 -0700 Subject: [PATCH] Expose getAllWebContents() API --- lib/browser/api/web-contents.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/browser/api/web-contents.js b/lib/browser/api/web-contents.js index c17206426a..5515984571 100644 --- a/lib/browser/api/web-contents.js +++ b/lib/browser/api/web-contents.js @@ -2,7 +2,6 @@ const {EventEmitter} = require('events') const {app, ipcMain, session, Menu, NavigationController} = require('electron') -const {getAllWebContents} = process.atomBinding('web_contents') // session is not used here, the purpose is to make sure session is initalized // before the webContents module. @@ -249,7 +248,7 @@ module.exports = { getFocusedWebContents () { let focused = null - for (let contents of getAllWebContents()) { + for (let contents of binding.getAllWebContents()) { if (!contents.isFocused()) continue if (focused == null) focused = contents // Return webview web contents which may be embedded inside another @@ -257,5 +256,9 @@ module.exports = { if (contents.getType() === 'webview') return contents } return focused + }, + + getAllWebContents () { + return binding.getAllWebContents() } }