aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/recipe.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/webview/recipe.js')
-rw-r--r--src/webview/recipe.js17
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 }