From 7f806bd1557c791dba228c1c80d9808408330f16 Mon Sep 17 00:00:00 2001 From: Cutls Date: Fri, 14 Jun 2019 23:21:08 +0900 Subject: [PATCH] Add: sendSinmpleIpc for 'about' #86 --- app/js/common/about.js | 4 +--- app/js/platform/preload.js | 3 +++ app/main.js | 5 ++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/js/common/about.js b/app/js/common/about.js index 77d76a8a..4b8cc30b 100644 --- a/app/js/common/about.js +++ b/app/js/common/about.js @@ -1,6 +1,4 @@ //このソフトについて function about() { - var electron = require("electron"); - var ipc = electron.ipcRenderer; - ipc.send('about', 'go'); + postMessage(["sendSinmpleIpc", "about"], "*") } \ No newline at end of file diff --git a/app/js/platform/preload.js b/app/js/platform/preload.js index 75f563d0..0d41a915 100644 --- a/app/js/platform/preload.js +++ b/app/js/platform/preload.js @@ -3,6 +3,9 @@ var ipc = electron.ipcRenderer; onmessage = function (e) { if (e.data[0] == "openUrl") { shell.openExternal(e.data[1]); + } else if (e.data[0] == "sendSinmpleIpc") { + ipc.send(e.data[1], "") + } } ipc.on('reload', function (event, arg) { diff --git a/app/main.js b/app/main.js index 2b47c5b3..57b237e8 100644 --- a/app/main.js +++ b/app/main.js @@ -99,12 +99,11 @@ function createWindow() { webviewTag: false, nodeIntegration: false, contextIsolation: true, - preload: dir + "/js/platform/preload.js" + preload: join(__dirname,"js", "platform", "preload.js") }, width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, icon: __dirname + '/desk.png' } } else if (platform == "win32") { - console.log(join(__dirname,"js", "platform", "preload.js")) var arg = { webPreferences: { webviewTag: false, @@ -120,7 +119,7 @@ function createWindow() { webviewTag: false, nodeIntegration: false, contextIsolation: true, - preload: dir + "/js/platform/preload.js" + preload: join(__dirname,"js", "platform", "preload.js") }, width: window_size.width, height: window_size.height, x: window_size.x, y: window_size.y, simpleFullscreen: true }