Przeglądaj źródła

fix: remove redundant flags

Gerald 8 lat temu
rodzic
commit
c976565872
2 zmienionych plików z 3 dodań i 9 usunięć
  1. 1 4
      scripts/webpack.base.conf.js
  2. 2 5
      src/background/utils/values.js

+ 1 - 4
scripts/webpack.base.conf.js

@@ -8,10 +8,7 @@ const { IS_DEV, styleRule } = require('./utils');
 const { MINIFY } = process.env;
 const DIST = 'dist';
 const definePlugin = new webpack.DefinePlugin({
-  'process.env': {
-    NODE_ENV: JSON.stringify(process.env.NODE_ENV),
-    DEBUG: IS_DEV ? 'true' : 'false', // whether to log message errors
-  },
+  'process.env.DEBUG': IS_DEV ? 'true' : 'false', // whether to log message errors
 });
 
 function resolve(dir) {

+ 2 - 5
src/background/utils/values.js

@@ -3,7 +3,6 @@ import { getValueStoresByIds, dumpValueStores, dumpValueStore } from './db';
 
 let cache;
 let timer;
-let updating;
 
 export function updateValueStore(id, update) {
   updateLater();
@@ -23,7 +22,7 @@ export function setValueStore(where, value) {
 }
 
 function updateLater() {
-  if (!updating && !timer) {
+  if (!timer) {
     timer = Promise.resolve().then(doUpdate);
     // timer = setTimeout(doUpdate);
   }
@@ -32,9 +31,7 @@ function updateLater() {
 function doUpdate() {
   const currentCache = cache;
   cache = null;
-  timer = null;
   const ids = Object.keys(currentCache);
-  updating = true;
   getValueStoresByIds(ids)
   .then(valueStores => {
     ids.forEach(id => {
@@ -51,7 +48,7 @@ function doUpdate() {
   })
   .then(broadcastUpdates)
   .then(() => {
-    updating = false;
+    timer = null;
     if (cache) updateLater();
   });
 }