Add the option to enable node integration in BrowserWindow 72/230172/1
authorhyunduk.kim <hyunduk.kim@samsung.com>
Wed, 8 Apr 2020 09:00:23 +0000 (18:00 +0900)
committerhyunduk.kim <hyunduk.kim@samsung.com>
Wed, 8 Apr 2020 09:00:23 +0000 (18:00 +0900)
To use node in renderer in case of electron app in m76,
nodeIntegration must be set as true explicitly
when creating an instance of BrowserWindow.

Change-Id: I13126b22c843c177821c4670d6969bf8425e9251
Signed-off-by: hyunduk.kim <hyunduk.kim@samsung.com>
main.js

diff --git a/main.js b/main.js
index 13a9d267e81f12027d615130398e7ee8e6854340..1e074a318faf4af05047546253b14150638203bf 100755 (executable)
--- a/main.js
+++ b/main.js
@@ -21,7 +21,13 @@ app.on('window-all-closed', function() {
 app.on('ready', function() {
   console.log('ready');
   // Create the browser window.
-  mainWindow = new BrowserWindow({width: 800, height: 600});
+  mainWindow = new BrowserWindow({
+    width: 800,
+    height: 600,
+    webPreferences: {
+      nodeIntegration: true
+    }
+  });
 
   // and load the index.html of the app.
   mainWindow.loadURL('file://' + __dirname + '/index.html');