aboutsummaryrefslogtreecommitdiffstats
path: root/src/webview/lib/RecipeWebview.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/webview/lib/RecipeWebview.ts')
-rw-r--r--src/webview/lib/RecipeWebview.ts11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/webview/lib/RecipeWebview.ts b/src/webview/lib/RecipeWebview.ts
index cf70164ef..e7a39579b 100644
--- a/src/webview/lib/RecipeWebview.ts
+++ b/src/webview/lib/RecipeWebview.ts
@@ -2,8 +2,7 @@ import { ipcRenderer } from 'electron';
2import { BrowserWindow } from '@electron/remote'; 2import { BrowserWindow } from '@electron/remote';
3import { pathExistsSync, readFileSync, existsSync } from 'fs-extra'; 3import { pathExistsSync, readFileSync, existsSync } from 'fs-extra';
4 4
5// TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed 5const debug = require('../../preload-safe-debug')('Ferdium:Plugin:RecipeWebview');
6// const debug = require('debug')('Ferdium:Plugin:RecipeWebview');
7 6
8class RecipeWebview { 7class RecipeWebview {
9 badgeHandler: any; 8 badgeHandler: any;
@@ -28,7 +27,7 @@ class RecipeWebview {
28 ipcRenderer.on('poll', () => { 27 ipcRenderer.on('poll', () => {
29 this.loopFunc(); 28 this.loopFunc();
30 29
31 console.log('Poll event'); 30 debug('Poll event');
32 31
33 // This event is for checking if the service recipe is still actively 32 // This event is for checking if the service recipe is still actively
34 // communicating with the client 33 // communicating with the client
@@ -110,7 +109,7 @@ class RecipeWebview {
110 109
111 if (head) { 110 if (head) {
112 head.append(styles); 111 head.append(styles);
113 console.log('Append styles', styles); 112 debug('Append styles', styles);
114 } 113 }
115 } 114 }
116 }); 115 });
@@ -122,13 +121,13 @@ class RecipeWebview {
122 if (existsSync(file)) { 121 if (existsSync(file)) {
123 return readFileSync(file, 'utf8'); 122 return readFileSync(file, 'utf8');
124 } 123 }
125 console.log('Script not found', file); 124 debug('Script not found', file);
126 return null; 125 return null;
127 }), 126 }),
128 ).then(scripts => { 127 ).then(scripts => {
129 const scriptsFound = scripts.filter(script => script !== null); 128 const scriptsFound = scripts.filter(script => script !== null);
130 if (scriptsFound.length > 0) { 129 if (scriptsFound.length > 0) {
131 console.log('Inject scripts to main world', scriptsFound); 130 debug('Inject scripts to main world', scriptsFound);
132 ipcRenderer.sendToHost('inject-js-unsafe', ...scriptsFound); 131 ipcRenderer.sendToHost('inject-js-unsafe', ...scriptsFound);
133 } 132 }
134 }); 133 });