فهرست منبع

style: remove unnecessary console.log

Ahmad Kholid 3 سال پیش
والد
کامیت
20188b0ddd

+ 2 - 6
src/background/blocks-handler.js

@@ -65,7 +65,6 @@ export async function closeTab(block) {
 export async function trigger(block) {
   const nextBlockId = getBlockConnection(block);
   try {
-    console.log(this.tabId);
     if (block.data.type === 'visit-web' && this.tabId) {
       await browser.tabs.executeScript(this.tabId, {
         file: './contentScript.bundle.js',
@@ -166,7 +165,7 @@ export function newTab(block) {
         });
       })
       .catch((error) => {
-        console.error(error, 'nnnaa');
+        console.error(error);
         reject(error);
       });
   });
@@ -343,9 +342,6 @@ export function elementExists(block) {
       id: block.name,
       once: true,
       callback: (data) => {
-        console.log(data, 'element-exists');
-        console.log(block.connections, getBlockConnection(block, data ? 1 : 2));
-
         resolve({
           data,
           nextBlockId: getBlockConnection(block, data ? 1 : 2),
@@ -376,7 +372,7 @@ export function conditions({ data, outputs }, prevBlockData) {
         outputIndex = index + 1;
       }
     });
-    console.log(resultData, outputIndex);
+
     resolve({
       data: resultData,
       nextBlockId: getBlockConnection({ outputs }, outputIndex),

+ 3 - 3
src/background/index.js

@@ -44,7 +44,7 @@ browser.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
       return tab.url.match(isRegex ? new RegExp(url, 'g') : url);
     });
     const state = await workflowState.get((item) => item.state.tabId === tabId);
-    console.log(state.length, state);
+
     if (trigger && state.length === 0) {
       const workflow = await getWorkflow(trigger.id);
 
@@ -55,7 +55,7 @@ browser.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => {
 browser.alarms.onAlarm.addListener(({ name }) => {
   getWorkflow(name).then((workflow) => {
     if (!workflow) return;
-    console.log(workflow, 'alarm');
+
     executeWorkflow(workflow);
   });
 });
@@ -83,7 +83,7 @@ const message = new MessageListener('background');
 message.on('workflow:execute', (workflow) => executeWorkflow(workflow));
 message.on('workflow:stop', (id) => {
   const workflow = runningWorkflows[id];
-  console.log(runningWorkflows, id);
+
   if (!workflow) {
     workflowState.delete(id);
     return;

+ 2 - 14
src/background/workflow-engine.js

@@ -44,7 +44,6 @@ function tabUpdatedHandler(tabId, changeInfo) {
     });
   } else if (this.tabId === tabId) {
     if (!reloadTimeout) {
-      console.log('===Register Timeout===');
       reloadTimeout = setTimeout(() => {
         this.isPaused = false;
       }, 15000);
@@ -53,7 +52,6 @@ function tabUpdatedHandler(tabId, changeInfo) {
     this.isPaused = true;
 
     if (changeInfo.status === 'complete') {
-      console.log('clearTimeout');
       clearTimeout(reloadTimeout);
       reloadTimeout = null;
 
@@ -62,7 +60,6 @@ function tabUpdatedHandler(tabId, changeInfo) {
           file: './contentScript.bundle.js',
         })
         .then(() => {
-          console.log(this.currentBlock);
           if (this.connectedTab) this._connectTab(this.tabId);
 
           this.isPaused = false;
@@ -196,7 +193,7 @@ class WorkflowEngine {
 
   dispatchEvent(name, params) {
     const listeners = this.eventListeners[name];
-    console.log(name, this.eventListeners);
+
     if (!listeners) return;
 
     listeners.forEach((callback) => {
@@ -225,15 +222,8 @@ class WorkflowEngine {
   }
 
   _blockHandler(block, prevBlockData) {
-    if (this.isDestroyed) {
-      console.log(
-        '%cDestroyed',
-        'color: red; font-size: 24px; font-weight: bold'
-      );
-      return;
-    }
+    if (this.isDestroyed) return;
     if (this.isPaused) {
-      console.log(this.isPaused, 'pause');
       setTimeout(() => {
         this._blockHandler(block, prevBlockData);
       }, 1000);
@@ -246,7 +236,6 @@ class WorkflowEngine {
     }, this.workflow.settings.timeout || 120000);
 
     workflowState.update(this.id, this.state);
-    console.log(`${block.name}:`, block);
 
     this.currentBlock = block;
 
@@ -278,7 +267,6 @@ class WorkflowEngine {
             });
             this.dispatchEvent('finish');
             this.destroy('success');
-            console.log('Done', this);
           }
 
           clearTimeout(this.workflowTimeout);

+ 0 - 1
src/background/workflow-state.js

@@ -60,7 +60,6 @@ class WorkflowState {
     return updater.call(
       this,
       (items, index) => {
-        console.log('state index', index, id, items);
         if (index !== -1) items.splice(index, 1);
 
         return items;

+ 0 - 1
src/components/newtab/workflow/WorkflowRunning.vue

@@ -53,7 +53,6 @@ defineProps({
 });
 
 function getBlock(item) {
-  console.log(item.state.currentBlock);
   if (!item.state.currentBlock) return {};
 
   return tasks[item.state.currentBlock.name];

+ 1 - 1
src/content/blocks-handler.js

@@ -175,7 +175,7 @@ export function elementExists({ data }) {
       }
 
       const element = document.querySelector(data.selector);
-      console.log(element, trying);
+
       if (element) {
         resolve(true);
       } else {

+ 1 - 2
src/content/index.js

@@ -5,10 +5,9 @@ import * as blocksHandler from './blocks-handler';
 
 function onConnectListener() {
   browser.runtime.onConnect.addListener((port) => {
-    console.log('Connect');
     port.onMessage.addListener((data) => {
       const handler = blocksHandler[toCamelCase(data.name)];
-      console.log(`${data.name}(${toCamelCase(data.name)}):`, data);
+
       if (handler) {
         handler(data).then((result) => {
           port.postMessage({ type: data.name, data: result });

+ 1 - 3
src/newtab/App.vue

@@ -17,8 +17,7 @@ const retrieved = ref(false);
 store.dispatch('retrieveWorkflowState');
 store
   .dispatch('retrieve', ['workflows', 'logs'])
-  .then((res) => {
-    console.log(res);
+  .then(() => {
     retrieved.value = true;
   })
   .catch(() => {
@@ -34,7 +33,6 @@ function handleStorageChanged(change) {
   }
 
   if (change.workflowState) {
-    console.log(change.workflowState.newValue);
     store.commit('updateState', {
       key: 'workflowState',
       value: change.workflowState.newValue,

+ 2 - 5
src/newtab/pages/workflows/[id].vue

@@ -220,7 +220,6 @@ async function handleWorkflowTrigger({ data }) {
           when: data.date ? new Date(data.date).getTime() : Date.now() + 60000,
         };
       } else {
-        console.log(workflowAlarm, 'workflow-alarm');
         alarmInfo = {
           periodInMinutes: data.interval,
         };
@@ -241,7 +240,7 @@ async function handleWorkflowTrigger({ data }) {
       } else {
         visitWebTriggers[visitWebTriggerIndex] = payload;
       }
-      console.log(visitWebTriggers);
+
       await browser.storage.local.set({ visitWebTriggers });
     }
   } catch (error) {
@@ -278,9 +277,7 @@ function executeWorkflow() {
     isTesting: state.isDataChanged,
   };
 
-  sendMessage('workflow:execute', payload, 'background').then(() => {
-    console.log('the fuck');
-  });
+  sendMessage('workflow:execute', payload, 'background');
 }
 function handleEditorDataChanged() {
   state.isDataChanged = true;