diff options
author | Stefan Malzner <stefan@adlk.io> | 2018-12-22 15:03:46 +0100 |
---|---|---|
committer | Stefan Malzner <stefan@adlk.io> | 2018-12-22 15:03:46 +0100 |
commit | 5ad6eea6ea24bf6b4cdb8b314150c6fa5f9da896 (patch) | |
tree | 11907a50c6ed914c13b9264fa233ec9c03f32579 /src/webview | |
parent | bump version to b22 (diff) | |
download | ferdium-app-5ad6eea6ea24bf6b4cdb8b314150c6fa5f9da896.tar.gz ferdium-app-5ad6eea6ea24bf6b4cdb8b314150c6fa5f9da896.tar.zst ferdium-app-5ad6eea6ea24bf6b4cdb8b314150c6fa5f9da896.zip |
Make electron 4 compatible
Diffstat (limited to 'src/webview')
-rw-r--r-- | src/webview/recipe.js | 17 |
1 files changed, 9 insertions, 8 deletions
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 { | |||
42 | 42 | ||
43 | async initialize() { | 43 | async initialize() { |
44 | Object.keys(this.ipcEvents).forEach((channel) => { | 44 | Object.keys(this.ipcEvents).forEach((channel) => { |
45 | ipcRenderer.on(channel, (event, data) => { | 45 | ipcRenderer.on(channel, (...args) => { |
46 | debug('Received IPC event for channel', channel, 'with', data); | 46 | debug('Received IPC event for channel', channel, 'with', ...args); |
47 | this[this.ipcEvents[channel]](event, data); | 47 | this[this.ipcEvents[channel]](...args); |
48 | }); | 48 | }); |
49 | }); | 49 | }); |
50 | 50 | ||
@@ -62,17 +62,18 @@ class RecipeController { | |||
62 | autorun(() => this.update()); | 62 | autorun(() => this.update()); |
63 | } | 63 | } |
64 | 64 | ||
65 | loadRecipeModule(event, data) { | 65 | loadRecipeModule(event, config, recipe) { |
66 | debug('loadRecipeModule'); | 66 | debug('loadRecipeModule'); |
67 | const modulePath = path.join(data.recipe.path, 'webview.js'); | 67 | const modulePath = path.join(recipe.path, 'webview.js'); |
68 | debug('module path', modulePath); | ||
68 | // Delete module from cache | 69 | // Delete module from cache |
69 | delete require.cache[require.resolve(modulePath)]; | 70 | delete require.cache[require.resolve(modulePath)]; |
70 | try { | 71 | try { |
71 | // eslint-disable-next-line | 72 | // eslint-disable-next-line |
72 | require(modulePath)(new RecipeWebview(), data); | 73 | require(modulePath)(new RecipeWebview(), {...config, recipe,}); |
73 | debug('Initialize Recipe', data); | 74 | debug('Initialize Recipe', config, recipe); |
74 | 75 | ||
75 | this.settings.service = data; | 76 | this.settings.service = config; |
76 | } catch (err) { | 77 | } catch (err) { |
77 | console.error('Recipe initialization failed', err); | 78 | console.error('Recipe initialization failed', err); |
78 | } | 79 | } |