aboutsummaryrefslogtreecommitdiffstats
path: root/src/features/todos
diff options
context:
space:
mode:
authorLibravatar Vijay Aravamudhan <vraravam@users.noreply.github.com>2022-04-22 15:04:21 -0500
committerLibravatar GitHub <noreply@github.com>2022-04-22 20:04:21 +0000
commit759d93dc198a3cc8c5265245c0144efa5435682b (patch)
tree53e963a085d3d12af5a2efa2f1ab6f3e5574edc7 /src/features/todos
parentAdded build scripts for linux, macos and windows to help new contributors get... (diff)
downloadferdium-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/features/todos')
-rw-r--r--src/features/todos/preload.ts7
-rw-r--r--src/features/todos/store.js23
2 files changed, 16 insertions, 14 deletions
diff --git a/src/features/todos/preload.ts b/src/features/todos/preload.ts
index 896d82bdf..4ccee39a0 100644
--- a/src/features/todos/preload.ts
+++ b/src/features/todos/preload.ts
@@ -1,9 +1,10 @@
1import { ipcRenderer } from 'electron'; 1import { ipcRenderer } from 'electron';
2import { IPC } from './constants'; 2import { IPC } from './constants';
3 3
4const debug = require('debug')('Ferdium:feature:todos:preload'); 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:feature:todos:preload');
5 6
6debug('Preloading Todos Webview'); 7console.log('Preloading Todos Webview');
7 8
8let hostMessageListener = ({ action }) => { 9let hostMessageListener = ({ action }) => {
9 switch (action) { 10 switch (action) {
@@ -27,7 +28,7 @@ window['ferdium'] = {
27}; 28};
28 29
29ipcRenderer.on(IPC.TODOS_HOST_CHANNEL, (event, message) => { 30ipcRenderer.on(IPC.TODOS_HOST_CHANNEL, (event, message) => {
30 debug('Received host message', event, message); 31 console.log('Received host message', event, message);
31 hostMessageListener(message); 32 hostMessageListener(message);
32}); 33});
33 34
diff --git a/src/features/todos/store.js b/src/features/todos/store.js
index 90ea47c71..41e632b49 100644
--- a/src/features/todos/store.js
+++ b/src/features/todos/store.js
@@ -18,7 +18,8 @@ import { createActionBindings } from '../utils/ActionBinding';
18import { IPC, TODOS_ROUTES } from './constants'; 18import { IPC, TODOS_ROUTES } from './constants';
19import UserAgent from '../../models/UserAgent'; 19import UserAgent from '../../models/UserAgent';
20 20
21const debug = require('debug')('Ferdium:feature:todos:store'); 21// TODO: Go back to 'debug' from 'console.log' when https://github.com/electron/electron/issues/31689 is fixed
22// const debug = require('debug')('Ferdium:feature:todos:store');
22 23
23export default class TodoStore extends FeatureStore { 24export default class TodoStore extends FeatureStore {
24 @observable stores = null; 25 @observable stores = null;
@@ -96,7 +97,7 @@ export default class TodoStore extends FeatureStore {
96 // ========== PUBLIC API ========= // 97 // ========== PUBLIC API ========= //
97 98
98 @action start(stores, actions) { 99 @action start(stores, actions) {
99 debug('TodoStore::start'); 100 console.log('TodoStore::start');
100 this.stores = stores; 101 this.stores = stores;
101 this.actions = actions; 102 this.actions = actions;
102 103
@@ -133,7 +134,7 @@ export default class TodoStore extends FeatureStore {
133 134
134 @action stop() { 135 @action stop() {
135 super.stop(); 136 super.stop();
136 debug('TodoStore::stop'); 137 console.log('TodoStore::stop');
137 this.reset(); 138 this.reset();
138 this.isFeatureActive = false; 139 this.isFeatureActive = false;
139 } 140 }
@@ -162,7 +163,7 @@ export default class TodoStore extends FeatureStore {
162 }; 163 };
163 164
164 @action _setTodosWebview = ({ webview }) => { 165 @action _setTodosWebview = ({ webview }) => {
165 debug('_setTodosWebview', webview); 166 console.log('_setTodosWebview', webview);
166 if (this.webview !== webview) { 167 if (this.webview !== webview) {
167 this.webview = webview; 168 this.webview = webview;
168 this.userAgentModel.setWebviewReference(webview); 169 this.userAgentModel.setWebviewReference(webview);
@@ -170,14 +171,14 @@ export default class TodoStore extends FeatureStore {
170 }; 171 };
171 172
172 @action _handleHostMessage = message => { 173 @action _handleHostMessage = message => {
173 debug('_handleHostMessage', message); 174 console.log('_handleHostMessage', message);
174 if (message.action === 'todos:create') { 175 if (message.action === 'todos:create') {
175 this.webview.send(IPC.TODOS_HOST_CHANNEL, message); 176 this.webview.send(IPC.TODOS_HOST_CHANNEL, message);
176 } 177 }
177 }; 178 };
178 179
179 @action _handleClientMessage = ({ channel, message = {} }) => { 180 @action _handleClientMessage = ({ channel, message = {} }) => {
180 debug('_handleClientMessage', channel, message); 181 console.log('_handleClientMessage', channel, message);
181 switch (message.action) { 182 switch (message.action) {
182 case 'todos:initialized': 183 case 'todos:initialized':
183 this._onTodosClientInitialized(); 184 this._onTodosClientInitialized();
@@ -186,7 +187,7 @@ export default class TodoStore extends FeatureStore {
186 this._goToService(message.data); 187 this._goToService(message.data);
187 break; 188 break;
188 default: 189 default:
189 debug('Other message received', channel, message); 190 console.log('Other message received', channel, message);
190 if (this.stores.services.isTodosServiceAdded) { 191 if (this.stores.services.isTodosServiceAdded) {
191 this.actions.service.handleIPCMessage({ 192 this.actions.service.handleIPCMessage({
192 serviceId: this.stores.services.isTodosServiceAdded.id, 193 serviceId: this.stores.services.isTodosServiceAdded.id,
@@ -202,7 +203,7 @@ export default class TodoStore extends FeatureStore {
202 }; 203 };
203 204
204 @action _toggleTodosFeatureVisibility = () => { 205 @action _toggleTodosFeatureVisibility = () => {
205 debug('_toggleTodosFeatureVisibility'); 206 console.log('_toggleTodosFeatureVisibility');
206 207
207 this._updateSettings({ 208 this._updateSettings({
208 isFeatureEnabledByUser: !this.settings.isFeatureEnabledByUser, 209 isFeatureEnabledByUser: !this.settings.isFeatureEnabledByUser,
@@ -210,14 +211,14 @@ export default class TodoStore extends FeatureStore {
210 }; 211 };
211 212
212 _openDevTools = () => { 213 _openDevTools = () => {
213 debug('_openDevTools'); 214 console.log('_openDevTools');
214 215
215 const webview = document.querySelector('#todos-panel webview'); 216 const webview = document.querySelector('#todos-panel webview');
216 if (webview) webview.openDevTools(); 217 if (webview) webview.openDevTools();
217 }; 218 };
218 219
219 _reload = () => { 220 _reload = () => {
220 debug('_reload'); 221 console.log('_reload');
221 222
222 const webview = document.querySelector('#todos-panel webview'); 223 const webview = document.querySelector('#todos-panel webview');
223 if (webview) webview.reload(); 224 if (webview) webview.reload();
@@ -285,7 +286,7 @@ export default class TodoStore extends FeatureStore {
285 const { pathname } = this.stores.router.location; 286 const { pathname } = this.stores.router.location;
286 287
287 if (pathname === TODOS_ROUTES.TARGET) { 288 if (pathname === TODOS_ROUTES.TARGET) {
288 debug('Router is on todos route, show todos panel'); 289 console.log('Router is on todos route, show todos panel');
289 // todosStore.start(stores, actions); 290 // todosStore.start(stores, actions);
290 this.stores.router.push('/'); 291 this.stores.router.push('/');
291 292