From f1b710c194e6d7b88d9e1c6b0fc91cb53cda0034 Mon Sep 17 00:00:00 2001 From: menelike Date: Tue, 6 Sep 2016 18:36:56 +0200 Subject: [PATCH 1/2] add desktopCapturer api to enable screen capturing --- app/preload.js | 5 ++++- client/index.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/preload.js b/app/preload.js index 5d331be..45733f7 100644 --- a/app/preload.js +++ b/app/preload.js @@ -12,6 +12,7 @@ var _ = require('underscore'); var ipc = require('electron').ipcRenderer; var remote = require('electron').remote; var shell = require('electron').shell; +var desktopCapturer = require('electron').desktopCapturer; /** * Defines methods with which to extend the `Electron` module defined in `client.js`. @@ -81,5 +82,7 @@ ElectronImplementation = { listeners.push(callback); }, - _eventListeners: {} + _eventListeners: {}, + + desktopCapturer: desktopCapturer, }; diff --git a/client/index.js b/client/index.js index ca76f3f..d870887 100644 --- a/client/index.js +++ b/client/index.js @@ -52,7 +52,9 @@ Electron = { * @param {Function} callback - A function to invoke when `event` is triggered. Takes no arguments * and returns no value. */ - onWindowEvent: function() {} + onWindowEvent: function() {}, + + desktopCapturer: {} }; // Read `ElectronImplementation` from the window vs. doing `typeof ElectronImplementation` because From f775c0fa492abc123a09eb0df5a5fe16b8882a28 Mon Sep 17 00:00:00 2001 From: menelike Date: Tue, 6 Sep 2016 20:54:18 +0200 Subject: [PATCH 2/2] update comments --- app/preload.js | 3 +++ client/index.js | 3 +++ 2 files changed, 6 insertions(+) diff --git a/app/preload.js b/app/preload.js index 45733f7..df49cd7 100644 --- a/app/preload.js +++ b/app/preload.js @@ -84,5 +84,8 @@ ElectronImplementation = { _eventListeners: {}, + /** + * Expose Electrons desktopCapturer API used to enable screen capture. + */ desktopCapturer: desktopCapturer, }; diff --git a/client/index.js b/client/index.js index d870887..fd36bbc 100644 --- a/client/index.js +++ b/client/index.js @@ -54,6 +54,9 @@ Electron = { */ onWindowEvent: function() {}, + /** + * Expose Electrons desktopCapturer API used to enable screen capture. + */ desktopCapturer: {} };