diff options
author | Vijay Aravamudhan <vraravam@users.noreply.github.com> | 2022-04-22 15:04:21 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-22 20:04:21 +0000 |
commit | 759d93dc198a3cc8c5265245c0144efa5435682b (patch) | |
tree | 53e963a085d3d12af5a2efa2f1ab6f3e5574edc7 /src/webview | |
parent | Added build scripts for linux, macos and windows to help new contributors get... (diff) | |
download | ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.tar.gz ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.tar.zst ferdium-app-759d93dc198a3cc8c5265245c0144efa5435682b.zip |
Turn off usage of 'debug' npm package using with electron-16 (fixes #17)
Diffstat (limited to 'src/webview')
-rw-r--r-- | src/webview/badge.ts | 5 | ||||
-rw-r--r-- | src/webview/darkmode.ts | 7 | ||||
-rw-r--r-- | src/webview/dialogTitle.ts | 5 | ||||
-rw-r--r-- | src/webview/lib/RecipeWebview.ts | 11 | ||||
-rw-r--r-- | src/webview/notifications.ts | 5 | ||||
-rw-r--r-- | src/webview/recipe.js | 57 | ||||
-rw-r--r-- | src/webview/sessionHandler.ts | 7 | ||||
-rw-r--r-- | src/webview/spellchecker.ts | 9 |
8 files changed, 57 insertions, 49 deletions
diff --git a/src/webview/badge.ts b/src/webview/badge.ts index 1b66effb6..0ff1ecaf6 100644 --- a/src/webview/badge.ts +++ b/src/webview/badge.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | 2 | ||
3 | const debug = require('debug')('Ferdium:Plugin:BadgeHandler'); | 3 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
4 | // const debug = require('debug')('Ferdium:Plugin:BadgeHandler'); | ||
4 | 5 | ||
5 | export class BadgeHandler { | 6 | export class BadgeHandler { |
6 | // TODO: Need to extract this into a utility class and reuse outside of the recipes | 7 | // TODO: Need to extract this into a utility class and reuse outside of the recipes |
@@ -26,7 +27,7 @@ export class BadgeHandler { | |||
26 | indirect: this.safeParseInt(indirect), | 27 | indirect: this.safeParseInt(indirect), |
27 | }; | 28 | }; |
28 | 29 | ||
29 | debug('Sending badge count to host: %j', count); | 30 | console.log('Sending badge count to host: %j', count); |
30 | ipcRenderer.sendToHost('message-counts', count); | 31 | ipcRenderer.sendToHost('message-counts', count); |
31 | } | 32 | } |
32 | } | 33 | } |
diff --git a/src/webview/darkmode.ts b/src/webview/darkmode.ts index fbb0edf04..99ee68757 100644 --- a/src/webview/darkmode.ts +++ b/src/webview/darkmode.ts | |||
@@ -1,7 +1,8 @@ | |||
1 | import { join } from 'path'; | 1 | import { join } from 'path'; |
2 | import { pathExistsSync, readFileSync } from 'fs-extra'; | 2 | import { pathExistsSync, readFileSync } from 'fs-extra'; |
3 | 3 | ||
4 | const debug = require('debug')('Ferdium:DarkMode'); | 4 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
5 | // const debug = require('debug')('Ferdium:DarkMode'); | ||
5 | 6 | ||
6 | const chars = [...'abcdefghijklmnopqrstuvwxyz']; | 7 | const chars = [...'abcdefghijklmnopqrstuvwxyz']; |
7 | 8 | ||
@@ -26,7 +27,7 @@ export function injectDarkModeStyle(recipePath: string) { | |||
26 | 27 | ||
27 | document.querySelector('head')?.appendChild(styles); | 28 | document.querySelector('head')?.appendChild(styles); |
28 | 29 | ||
29 | debug('Injected Dark Mode style with ID', ID); | 30 | console.log('Injected Dark Mode style with ID', ID); |
30 | } | 31 | } |
31 | } | 32 | } |
32 | 33 | ||
@@ -36,7 +37,7 @@ export function removeDarkModeStyle() { | |||
36 | if (style) { | 37 | if (style) { |
37 | style.remove(); | 38 | style.remove(); |
38 | 39 | ||
39 | debug('Removed Dark Mode Style with ID', ID); | 40 | console.log('Removed Dark Mode Style with ID', ID); |
40 | } | 41 | } |
41 | } | 42 | } |
42 | 43 | ||
diff --git a/src/webview/dialogTitle.ts b/src/webview/dialogTitle.ts index 393c2499f..a5bcb4c41 100644 --- a/src/webview/dialogTitle.ts +++ b/src/webview/dialogTitle.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { ipcRenderer } from 'electron'; | 1 | import { ipcRenderer } from 'electron'; |
2 | 2 | ||
3 | const debug = require('debug')('Ferdium:Plugin:DialogTitleHandler'); | 3 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
4 | // const debug = require('debug')('Ferdium:Plugin:DialogTitleHandler'); | ||
4 | 5 | ||
5 | export class DialogTitleHandler { | 6 | export class DialogTitleHandler { |
6 | titleCache: { title: string }; | 7 | titleCache: { title: string }; |
@@ -25,7 +26,7 @@ export class DialogTitleHandler { | |||
25 | return; | 26 | return; |
26 | } | 27 | } |
27 | 28 | ||
28 | debug('Sending active dialog title to host %s', newTitle); | 29 | console.log('Sending active dialog title to host %s', newTitle); |
29 | ipcRenderer.sendToHost('active-dialog-title', newTitle); | 30 | ipcRenderer.sendToHost('active-dialog-title', newTitle); |
30 | 31 | ||
31 | this.titleCache.title = newTitle; | 32 | this.titleCache.title = newTitle; |
diff --git a/src/webview/lib/RecipeWebview.ts b/src/webview/lib/RecipeWebview.ts index 568c31255..cf70164ef 100644 --- a/src/webview/lib/RecipeWebview.ts +++ b/src/webview/lib/RecipeWebview.ts | |||
@@ -2,7 +2,8 @@ import { ipcRenderer } from 'electron'; | |||
2 | import { BrowserWindow } from '@electron/remote'; | 2 | import { BrowserWindow } from '@electron/remote'; |
3 | import { pathExistsSync, readFileSync, existsSync } from 'fs-extra'; | 3 | import { pathExistsSync, readFileSync, existsSync } from 'fs-extra'; |
4 | 4 | ||
5 | const debug = require('debug')('Ferdium:Plugin:RecipeWebview'); | 5 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
6 | // const debug = require('debug')('Ferdium:Plugin:RecipeWebview'); | ||
6 | 7 | ||
7 | class RecipeWebview { | 8 | class RecipeWebview { |
8 | badgeHandler: any; | 9 | badgeHandler: any; |
@@ -27,7 +28,7 @@ class RecipeWebview { | |||
27 | ipcRenderer.on('poll', () => { | 28 | ipcRenderer.on('poll', () => { |
28 | this.loopFunc(); | 29 | this.loopFunc(); |
29 | 30 | ||
30 | debug('Poll event'); | 31 | console.log('Poll event'); |
31 | 32 | ||
32 | // This event is for checking if the service recipe is still actively | 33 | // This event is for checking if the service recipe is still actively |
33 | // communicating with the client | 34 | // communicating with the client |
@@ -109,7 +110,7 @@ class RecipeWebview { | |||
109 | 110 | ||
110 | if (head) { | 111 | if (head) { |
111 | head.append(styles); | 112 | head.append(styles); |
112 | debug('Append styles', styles); | 113 | console.log('Append styles', styles); |
113 | } | 114 | } |
114 | } | 115 | } |
115 | }); | 116 | }); |
@@ -121,13 +122,13 @@ class RecipeWebview { | |||
121 | if (existsSync(file)) { | 122 | if (existsSync(file)) { |
122 | return readFileSync(file, 'utf8'); | 123 | return readFileSync(file, 'utf8'); |
123 | } | 124 | } |
124 | debug('Script not found', file); | 125 | console.log('Script not found', file); |
125 | return null; | 126 | return null; |
126 | }), | 127 | }), |
127 | ).then(scripts => { | 128 | ).then(scripts => { |
128 | const scriptsFound = scripts.filter(script => script !== null); | 129 | const scriptsFound = scripts.filter(script => script !== null); |
129 | if (scriptsFound.length > 0) { | 130 | if (scriptsFound.length > 0) { |
130 | debug('Inject scripts to main world', scriptsFound); | 131 | console.log('Inject scripts to main world', scriptsFound); |
131 | ipcRenderer.sendToHost('inject-js-unsafe', ...scriptsFound); | 132 | ipcRenderer.sendToHost('inject-js-unsafe', ...scriptsFound); |
132 | } | 133 | } |
133 | }); | 134 | }); |
diff --git a/src/webview/notifications.ts b/src/webview/notifications.ts index 5ae99424c..ff9c844d0 100644 --- a/src/webview/notifications.ts +++ b/src/webview/notifications.ts | |||
@@ -2,7 +2,8 @@ import { ipcRenderer } from 'electron'; | |||
2 | 2 | ||
3 | import { v1 as uuidV1 } from 'uuid'; | 3 | import { v1 as uuidV1 } from 'uuid'; |
4 | 4 | ||
5 | const debug = require('debug')('Ferdium:Notifications'); | 5 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
6 | // const debug = require('debug')('Ferdium:Notifications'); | ||
6 | 7 | ||
7 | export class NotificationsHandler { | 8 | export class NotificationsHandler { |
8 | onNotify = (data: { title: string; options: any; notificationId: string }) => | 9 | onNotify = (data: { title: string; options: any; notificationId: string }) => |
@@ -10,7 +11,7 @@ export class NotificationsHandler { | |||
10 | 11 | ||
11 | displayNotification(title: string, options: any) { | 12 | displayNotification(title: string, options: any) { |
12 | return new Promise(resolve => { | 13 | return new Promise(resolve => { |
13 | debug('New notification', title, options); | 14 | console.log('New notification', title, options); |
14 | 15 | ||
15 | const notificationId = uuidV1(); | 16 | const notificationId = uuidV1(); |
16 | 17 | ||
diff --git a/src/webview/recipe.js b/src/webview/recipe.js index 4fcf28363..1f3017ccd 100644 --- a/src/webview/recipe.js +++ b/src/webview/recipe.js | |||
@@ -50,7 +50,8 @@ import { | |||
50 | 50 | ||
51 | import { DEFAULT_APP_SETTINGS } from '../config'; | 51 | import { DEFAULT_APP_SETTINGS } from '../config'; |
52 | 52 | ||
53 | const debug = require('debug')('Ferdium:Plugin'); | 53 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
54 | // const debug = require('debug')('Ferdium:Plugin'); | ||
54 | 55 | ||
55 | const badgeHandler = new BadgeHandler(); | 56 | const badgeHandler = new BadgeHandler(); |
56 | 57 | ||
@@ -64,7 +65,7 @@ const notificationsHandler = new NotificationsHandler(); | |||
64 | const originalWindowOpen = window.open; | 65 | const originalWindowOpen = window.open; |
65 | 66 | ||
66 | window.open = (url, frameName, features) => { | 67 | window.open = (url, frameName, features) => { |
67 | debug('window.open', url, frameName, features); | 68 | console.log('window.open', url, frameName, features); |
68 | if (!url) { | 69 | if (!url) { |
69 | // The service hasn't yet supplied a URL (as used in Skype). | 70 | // The service hasn't yet supplied a URL (as used in Skype). |
70 | // Return a new dummy window object and wait for the service to change the properties | 71 | // Return a new dummy window object and wait for the service to change the properties |
@@ -170,12 +171,12 @@ class RecipeController { | |||
170 | async initialize() { | 171 | async initialize() { |
171 | for (const channel of Object.keys(this.ipcEvents)) { | 172 | for (const channel of Object.keys(this.ipcEvents)) { |
172 | ipcRenderer.on(channel, (...args) => { | 173 | ipcRenderer.on(channel, (...args) => { |
173 | debug('Received IPC event for channel', channel, 'with', ...args); | 174 | console.log('Received IPC event for channel', channel, 'with', ...args); |
174 | this[this.ipcEvents[channel]](...args); | 175 | this[this.ipcEvents[channel]](...args); |
175 | }); | 176 | }); |
176 | } | 177 | } |
177 | 178 | ||
178 | debug('Send "hello" to host'); | 179 | console.log('Send "hello" to host'); |
179 | setTimeout(() => ipcRenderer.sendToHost('hello'), 100); | 180 | setTimeout(() => ipcRenderer.sendToHost('hello'), 100); |
180 | 181 | ||
181 | this.spellcheckingProvider = null; | 182 | this.spellcheckingProvider = null; |
@@ -198,9 +199,9 @@ class RecipeController { | |||
198 | } | 199 | } |
199 | 200 | ||
200 | loadRecipeModule(event, config, recipe) { | 201 | loadRecipeModule(event, config, recipe) { |
201 | debug('loadRecipeModule'); | 202 | console.log('loadRecipeModule'); |
202 | const modulePath = join(recipe.path, 'webview.js'); | 203 | const modulePath = join(recipe.path, 'webview.js'); |
203 | debug('module path', modulePath); | 204 | console.log('module path', modulePath); |
204 | // Delete module from cache | 205 | // Delete module from cache |
205 | delete require.cache[require.resolve(modulePath)]; | 206 | delete require.cache[require.resolve(modulePath)]; |
206 | try { | 207 | try { |
@@ -213,7 +214,7 @@ class RecipeController { | |||
213 | if (existsSync(modulePath)) { | 214 | if (existsSync(modulePath)) { |
214 | // eslint-disable-next-line import/no-dynamic-require | 215 | // eslint-disable-next-line import/no-dynamic-require |
215 | require(modulePath)(this.recipe, { ...config, recipe }); | 216 | require(modulePath)(this.recipe, { ...config, recipe }); |
216 | debug('Initialize Recipe', config, recipe); | 217 | console.log('Initialize Recipe', config, recipe); |
217 | } | 218 | } |
218 | 219 | ||
219 | this.settings.service = Object.assign(config, { recipe }); | 220 | this.settings.service = Object.assign(config, { recipe }); |
@@ -265,18 +266,18 @@ class RecipeController { | |||
265 | } | 266 | } |
266 | 267 | ||
267 | update() { | 268 | update() { |
268 | debug('enableSpellchecking', this.settings.app.enableSpellchecking); | 269 | console.log('enableSpellchecking', this.settings.app.enableSpellchecking); |
269 | debug('isDarkModeEnabled', this.settings.service.isDarkModeEnabled); | 270 | console.log('isDarkModeEnabled', this.settings.service.isDarkModeEnabled); |
270 | debug( | 271 | console.log( |
271 | 'System spellcheckerLanguage', | 272 | 'System spellcheckerLanguage', |
272 | this.settings.app.spellcheckerLanguage, | 273 | this.settings.app.spellcheckerLanguage, |
273 | ); | 274 | ); |
274 | debug( | 275 | console.log( |
275 | 'Service spellcheckerLanguage', | 276 | 'Service spellcheckerLanguage', |
276 | this.settings.service.spellcheckerLanguage, | 277 | this.settings.service.spellcheckerLanguage, |
277 | ); | 278 | ); |
278 | debug('darkReaderSettigs', this.settings.service.darkReaderSettings); | 279 | console.log('darkReaderSettigs', this.settings.service.darkReaderSettings); |
279 | debug('searchEngine', this.settings.app.searchEngine); | 280 | console.log('searchEngine', this.settings.app.searchEngine); |
280 | 281 | ||
281 | if (this.userscript && this.userscript.internal_setSettings) { | 282 | if (this.userscript && this.userscript.internal_setSettings) { |
282 | this.userscript.internal_setSettings(this.settings); | 283 | this.userscript.internal_setSettings(this.settings); |
@@ -284,10 +285,10 @@ class RecipeController { | |||
284 | 285 | ||
285 | if (this.settings.app.enableSpellchecking) { | 286 | if (this.settings.app.enableSpellchecking) { |
286 | let { spellcheckerLanguage } = this; | 287 | let { spellcheckerLanguage } = this; |
287 | debug(`Setting spellchecker language to ${spellcheckerLanguage}`); | 288 | console.log(`Setting spellchecker language to ${spellcheckerLanguage}`); |
288 | if (spellcheckerLanguage.includes('automatic')) { | 289 | if (spellcheckerLanguage.includes('automatic')) { |
289 | this.automaticLanguageDetection(); | 290 | this.automaticLanguageDetection(); |
290 | debug( | 291 | console.log( |
291 | 'Found `automatic` locale, falling back to user locale until detected', | 292 | 'Found `automatic` locale, falling back to user locale until detected', |
292 | this.settings.app.locale, | 293 | this.settings.app.locale, |
293 | ); | 294 | ); |
@@ -295,14 +296,14 @@ class RecipeController { | |||
295 | } | 296 | } |
296 | switchDict(spellcheckerLanguage, this.settings.service.id); | 297 | switchDict(spellcheckerLanguage, this.settings.service.id); |
297 | } else { | 298 | } else { |
298 | debug('Disable spellchecker'); | 299 | console.log('Disable spellchecker'); |
299 | } | 300 | } |
300 | 301 | ||
301 | if (!this.recipe) { | 302 | if (!this.recipe) { |
302 | this.hasUpdatedBeforeRecipeLoaded = true; | 303 | this.hasUpdatedBeforeRecipeLoaded = true; |
303 | } | 304 | } |
304 | 305 | ||
305 | debug( | 306 | console.log( |
306 | 'Darkmode enabled?', | 307 | 'Darkmode enabled?', |
307 | this.settings.service.isDarkModeEnabled, | 308 | this.settings.service.isDarkModeEnabled, |
308 | 'Dark theme active?', | 309 | 'Dark theme active?', |
@@ -322,11 +323,11 @@ class RecipeController { | |||
322 | this.settings.service.isDarkModeEnabled && | 323 | this.settings.service.isDarkModeEnabled && |
323 | this.settings.app.isDarkThemeActive !== false | 324 | this.settings.app.isDarkThemeActive !== false |
324 | ) { | 325 | ) { |
325 | debug('Enable dark mode'); | 326 | console.log('Enable dark mode'); |
326 | 327 | ||
327 | // Check if recipe has a custom dark mode handler | 328 | // Check if recipe has a custom dark mode handler |
328 | if (this.recipe && this.recipe.darkModeHandler) { | 329 | if (this.recipe && this.recipe.darkModeHandler) { |
329 | debug('Using custom dark mode handler'); | 330 | console.log('Using custom dark mode handler'); |
330 | 331 | ||
331 | // Remove other dark mode styles if they were already loaded | 332 | // Remove other dark mode styles if they were already loaded |
332 | if (this.hasUpdatedBeforeRecipeLoaded) { | 333 | if (this.hasUpdatedBeforeRecipeLoaded) { |
@@ -337,7 +338,7 @@ class RecipeController { | |||
337 | 338 | ||
338 | this.recipe.darkModeHandler(true, handlerConfig); | 339 | this.recipe.darkModeHandler(true, handlerConfig); |
339 | } else if (darkModeStyleExists(this.settings.service.recipe.path)) { | 340 | } else if (darkModeStyleExists(this.settings.service.recipe.path)) { |
340 | debug('Injecting darkmode from recipe'); | 341 | console.log('Injecting darkmode from recipe'); |
341 | injectDarkModeStyle(this.settings.service.recipe.path); | 342 | injectDarkModeStyle(this.settings.service.recipe.path); |
342 | 343 | ||
343 | // Make sure universal dark mode is disabled | 344 | // Make sure universal dark mode is disabled |
@@ -347,7 +348,7 @@ class RecipeController { | |||
347 | this.settings.app.universalDarkMode && | 348 | this.settings.app.universalDarkMode && |
348 | !ignoreList.includes(window.location.host) | 349 | !ignoreList.includes(window.location.host) |
349 | ) { | 350 | ) { |
350 | debug('Injecting Dark Reader'); | 351 | console.log('Injecting Dark Reader'); |
351 | 352 | ||
352 | // Use Dark Reader instead | 353 | // Use Dark Reader instead |
353 | const { brightness, contrast, sepia } = | 354 | const { brightness, contrast, sepia } = |
@@ -361,8 +362,8 @@ class RecipeController { | |||
361 | this.universalDarkModeInjected = true; | 362 | this.universalDarkModeInjected = true; |
362 | } | 363 | } |
363 | } else { | 364 | } else { |
364 | debug('Remove dark mode'); | 365 | console.log('Remove dark mode'); |
365 | debug('DarkMode disabled - removing remaining styles'); | 366 | console.log('DarkMode disabled - removing remaining styles'); |
366 | 367 | ||
367 | if (this.recipe && this.recipe.darkModeHandler) { | 368 | if (this.recipe && this.recipe.darkModeHandler) { |
368 | // Remove other dark mode styles if they were already loaded | 369 | // Remove other dark mode styles if they were already loaded |
@@ -374,10 +375,10 @@ class RecipeController { | |||
374 | 375 | ||
375 | this.recipe.darkModeHandler(false, handlerConfig); | 376 | this.recipe.darkModeHandler(false, handlerConfig); |
376 | } else if (isDarkModeStyleInjected()) { | 377 | } else if (isDarkModeStyleInjected()) { |
377 | debug('Removing injected darkmode from recipe'); | 378 | console.log('Removing injected darkmode from recipe'); |
378 | removeDarkModeStyle(); | 379 | removeDarkModeStyle(); |
379 | } else { | 380 | } else { |
380 | debug('Removing Dark Reader'); | 381 | console.log('Removing Dark Reader'); |
381 | 382 | ||
382 | disableDarkMode(); | 383 | disableDarkMode(); |
383 | this.universalDarkModeInjected = false; | 384 | this.universalDarkModeInjected = false; |
@@ -405,7 +406,7 @@ class RecipeController { | |||
405 | } | 406 | } |
406 | 407 | ||
407 | serviceIdEcho(event) { | 408 | serviceIdEcho(event) { |
408 | debug('Received a service echo ping'); | 409 | console.log('Received a service echo ping'); |
409 | event.sender.send('service-id', this.settings.service.id); | 410 | event.sender.send('service-id', this.settings.service.id); |
410 | } | 411 | } |
411 | 412 | ||
@@ -427,7 +428,7 @@ class RecipeController { | |||
427 | // Force a minimum length to get better detection results | 428 | // Force a minimum length to get better detection results |
428 | if (value.length < 25) return; | 429 | if (value.length < 25) return; |
429 | 430 | ||
430 | debug('Detecting language for', value); | 431 | console.log('Detecting language for', value); |
431 | const locale = await ipcRenderer.invoke('detect-language', { | 432 | const locale = await ipcRenderer.invoke('detect-language', { |
432 | sample: value, | 433 | sample: value, |
433 | }); | 434 | }); |
@@ -437,7 +438,7 @@ class RecipeController { | |||
437 | 438 | ||
438 | const spellcheckerLocale = | 439 | const spellcheckerLocale = |
439 | getSpellcheckerLocaleByFuzzyIdentifier(locale); | 440 | getSpellcheckerLocaleByFuzzyIdentifier(locale); |
440 | debug( | 441 | console.log( |
441 | 'Language detected reliably, setting spellchecker language to', | 442 | 'Language detected reliably, setting spellchecker language to', |
442 | spellcheckerLocale, | 443 | spellcheckerLocale, |
443 | ); | 444 | ); |
diff --git a/src/webview/sessionHandler.ts b/src/webview/sessionHandler.ts index e38368a18..a2906113d 100644 --- a/src/webview/sessionHandler.ts +++ b/src/webview/sessionHandler.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | const debug = require('debug')('Ferdium:Plugin:SessionHandler'); | 1 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
2 | // const debug = require('debug')('Ferdium:Plugin:SessionHandler'); | ||
2 | 3 | ||
3 | export class SessionHandler { | 4 | export class SessionHandler { |
4 | async releaseServiceWorkers() { | 5 | async releaseServiceWorkers() { |
@@ -7,10 +8,10 @@ export class SessionHandler { | |||
7 | await window.navigator.serviceWorker.getRegistrations(); | 8 | await window.navigator.serviceWorker.getRegistrations(); |
8 | for (const registration of registrations) { | 9 | for (const registration of registrations) { |
9 | registration.unregister(); | 10 | registration.unregister(); |
10 | debug('ServiceWorker unregistered'); | 11 | console.log('ServiceWorker unregistered'); |
11 | } | 12 | } |
12 | } catch (error) { | 13 | } catch (error) { |
13 | debug(error); | 14 | console.log(error); |
14 | } | 15 | } |
15 | } | 16 | } |
16 | } | 17 | } |
diff --git a/src/webview/spellchecker.ts b/src/webview/spellchecker.ts index bad2bb4ff..8cf16a7ba 100644 --- a/src/webview/spellchecker.ts +++ b/src/webview/spellchecker.ts | |||
@@ -2,7 +2,8 @@ import { ipcRenderer } from 'electron'; | |||
2 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; | 2 | import { SPELLCHECKER_LOCALES } from '../i18n/languages'; |
3 | import { isMac } from '../environment'; | 3 | import { isMac } from '../environment'; |
4 | 4 | ||
5 | const debug = require('debug')('Ferdium:spellchecker'); | 5 | // TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed |
6 | // const debug = require('debug')('Ferdium:spellchecker'); | ||
6 | 7 | ||
7 | export function getSpellcheckerLocaleByFuzzyIdentifier(identifier: string) { | 8 | export function getSpellcheckerLocaleByFuzzyIdentifier(identifier: string) { |
8 | const locales = Object.keys(SPELLCHECKER_LOCALES).filter( | 9 | const locales = Object.keys(SPELLCHECKER_LOCALES).filter( |
@@ -16,14 +17,14 @@ export function getSpellcheckerLocaleByFuzzyIdentifier(identifier: string) { | |||
16 | 17 | ||
17 | export function switchDict(fuzzyLocale: string, serviceId: string) { | 18 | export function switchDict(fuzzyLocale: string, serviceId: string) { |
18 | if (isMac) { | 19 | if (isMac) { |
19 | debug('Ignoring dictionary changes on macOS'); | 20 | console.log('Ignoring dictionary changes on macOS'); |
20 | return; | 21 | return; |
21 | } | 22 | } |
22 | 23 | ||
23 | debug(`Setting spellchecker locale from: ${fuzzyLocale}`); | 24 | console.log(`Setting spellchecker locale from: ${fuzzyLocale}`); |
24 | const locale = getSpellcheckerLocaleByFuzzyIdentifier(fuzzyLocale); | 25 | const locale = getSpellcheckerLocaleByFuzzyIdentifier(fuzzyLocale); |
25 | if (locale) { | 26 | if (locale) { |
26 | debug(`Sending spellcheck locales to host: ${locale}`); | 27 | console.log(`Sending spellcheck locales to host: ${locale}`); |
27 | ipcRenderer.send('set-spellchecker-locales', { locale, serviceId }); | 28 | ipcRenderer.send('set-spellchecker-locales', { locale, serviceId }); |
28 | } | 29 | } |
29 | } | 30 | } |