diff --git a/lib/renderer/api/remote.js b/lib/renderer/api/remote.js index 01d777e8526f..617a1fe81a22 100644 --- a/lib/renderer/api/remote.js +++ b/lib/renderer/api/remote.js @@ -250,16 +250,13 @@ ipcRenderer.on('ELECTRON_RENDERER_RELEASE_CALLBACK', function (event, id) { const browserModules = require('../../browser/api/exports/electron') // And add a helper receiver for each one. -var fn = function (name) { - return Object.defineProperty(exports, name, { +for (let name of Object.getOwnPropertyNames(browserModules)) { + Object.defineProperty(exports, name, { get: function () { return exports.getBuiltin(name) } }) } -for (var name in browserModules) { - fn(name) -} // Get remote module. exports.require = function (module) {