aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/workspaces/store.js
diff options
context:
space:
mode:
authorLibravatar Kristóf Marussy <kristof@marussy.com>2022-04-23 01:59:21 +0200
committerLibravatar GitHub <noreply@github.com>2022-04-22 23:59:21 +0000
commitd02644f7c41150709795e57bfd40351b4da35a7b (patch)
tree2403fb76bd5fae1703f8b55172ffce9e0a5d2bce /src/features/workspaces/store.js
parentComplete tray icons redesign for all platforms (#28) (diff)
downloadferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.tar.gz
ferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.tar.zst
ferdium-app-d02644f7c41150709795e57bfd40351b4da35a7b.zip
Preload safe debug shim (#29)
In https://github.com/ferdium/ferdium-app/pull/23 we removed usages of the debug package due to an electron bug. This patch aims to restore some debug functionality by introducing a shim. The shim detect whether if it is being introduced in a preload script where the electron but would be triggered, and falls back to a simple replacement for debug. However, in the main and renderer processes, where a preload script is not being used, we still get full debug functionality. In this way, a module can be used both in a preload script and outside of it, while still preserving debug functionality whenever possible. Signed-off-by: Kristóf Marussy <kristof@marussy.com>
Diffstat (limited to 'src/features/workspaces/store.js')
-rw-r--r--src/features/workspaces/store.js9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/features/workspaces/store.js b/src/features/workspaces/store.js
index d2ccfeccf..20d32df67 100644
--- a/src/features/workspaces/store.js
+++ b/src/features/workspaces/store.js
@@ -15,8 +15,7 @@ import { createActionBindings } from '../utils/ActionBinding';
15 15
16import { KEEP_WS_LOADED_USID } from '../../config'; 16import { KEEP_WS_LOADED_USID } from '../../config';
17 17
18// TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed 18const debug = require('../../preload-safe-debug')('Ferdium:feature:workspaces:store');
19// const debug = require('debug')('Ferdium:feature:workspaces:store');
20 19
21export default class WorkspacesStore extends FeatureStore { 20export default class WorkspacesStore extends FeatureStore {
22 @observable isFeatureActive = false; 21 @observable isFeatureActive = false;
@@ -70,7 +69,7 @@ export default class WorkspacesStore extends FeatureStore {
70 // ========== PUBLIC API ========= // 69 // ========== PUBLIC API ========= //
71 70
72 @action start(stores, actions) { 71 @action start(stores, actions) {
73 console.log('WorkspacesStore::start'); 72 debug('WorkspacesStore::start');
74 this.stores = stores; 73 this.stores = stores;
75 this.actions = actions; 74 this.actions = actions;
76 75
@@ -116,7 +115,7 @@ export default class WorkspacesStore extends FeatureStore {
116 115
117 @action stop() { 116 @action stop() {
118 super.stop(); 117 super.stop();
119 console.log('WorkspacesStore::stop'); 118 debug('WorkspacesStore::stop');
120 this.reset(); 119 this.reset();
121 this.isFeatureActive = false; 120 this.isFeatureActive = false;
122 } 121 }
@@ -274,7 +273,7 @@ export default class WorkspacesStore extends FeatureStore {
274 }; 273 };
275 274
276 _activateLastUsedWorkspaceReaction = () => { 275 _activateLastUsedWorkspaceReaction = () => {
277 console.log('_activateLastUsedWorkspaceReaction'); 276 debug('_activateLastUsedWorkspaceReaction');
278 if (!this.activeWorkspace && this.userHasWorkspaces) { 277 if (!this.activeWorkspace && this.userHasWorkspaces) {
279 const { lastActiveWorkspace } = this.settings; 278 const { lastActiveWorkspace } = this.settings;
280 if (lastActiveWorkspace) { 279 if (lastActiveWorkspace) {