diff --git a/lib/renderer/api/desktop-capturer.js b/lib/renderer/api/desktop-capturer.js index 3b9e5a6505bc..ff47dfd8e987 100644 --- a/lib/renderer/api/desktop-capturer.js +++ b/lib/renderer/api/desktop-capturer.js @@ -3,7 +3,10 @@ const {ipcRenderer, nativeImage} = require('electron') const includes = [].includes let currentId = 0 -const incrementId = () => currentId += 1 +const incrementId = () => { + currentId += 1 + return currentId +} // |options.type| can not be empty and has to include 'window' or 'screen'. function isValid (options) { @@ -27,7 +30,7 @@ exports.getSources = function (options, callback) { ipcRenderer.send('ELECTRON_BROWSER_DESKTOP_CAPTURER_GET_SOURCES', captureWindow, captureScreen, options.thumbnailSize, id) return ipcRenderer.once(`ELECTRON_RENDERER_DESKTOP_CAPTURER_RESULT_${id}`, (event, sources) => { callback(null, (() => { - results = [] + const results = [] sources.forEach(source => { results.push({ id: source.id,