From 5ad6eea6ea24bf6b4cdb8b314150c6fa5f9da896 Mon Sep 17 00:00:00 2001 From: Stefan Malzner Date: Sat, 22 Dec 2018 15:03:46 +0100 Subject: Make electron 4 compatible --- src/webview/recipe.js | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'src/webview/recipe.js') diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 944883899..9aa89ce01 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js @@ -42,9 +42,9 @@ class RecipeController { async initialize() { Object.keys(this.ipcEvents).forEach((channel) => { - ipcRenderer.on(channel, (event, data) => { - debug('Received IPC event for channel', channel, 'with', data); - this[this.ipcEvents[channel]](event, data); + ipcRenderer.on(channel, (...args) => { + debug('Received IPC event for channel', channel, 'with', ...args); + this[this.ipcEvents[channel]](...args); }); }); @@ -62,17 +62,18 @@ class RecipeController { autorun(() => this.update()); } - loadRecipeModule(event, data) { + loadRecipeModule(event, config, recipe) { debug('loadRecipeModule'); - const modulePath = path.join(data.recipe.path, 'webview.js'); + const modulePath = path.join(recipe.path, 'webview.js'); + debug('module path', modulePath); // Delete module from cache delete require.cache[require.resolve(modulePath)]; try { // eslint-disable-next-line - require(modulePath)(new RecipeWebview(), data); - debug('Initialize Recipe', data); + require(modulePath)(new RecipeWebview(), {...config, recipe,}); + debug('Initialize Recipe', config, recipe); - this.settings.service = data; + this.settings.service = config; } catch (err) { console.error('Recipe initialization failed', err); } -- cgit v1.2.3-54-g00ecf