ソースを参照

avoid console.log when not in debug-mode

Alexander Rose 5 年 前
コミット
067a85ef88

+ 4 - 1
src/mol-model-props/computed/chemistry/valence-model.ts

@@ -11,6 +11,7 @@ import { AtomGeometry, assignGeometry } from './geometry';
 import { bondCount, typeSymbol, formalCharge, bondToElementCount } from './util';
 import { ParamDefinition as PD } from '../../../mol-util/param-definition';
 import { RuntimeContext } from '../../../mol-task';
+import { isDebugMode } from '../../../mol-util/debug';
 
 /**
  * TODO:
@@ -270,7 +271,9 @@ export function calculateHydrogensCharge (structure: Structure, unit: Unit.Atomi
             break
 
         default:
-            console.warn('Requested charge, protonation for an unhandled element', element)
+            if (isDebugMode) {
+                console.warn('Requested charge, protonation for an unhandled element', element)
+            }
     }
 
     return [ charge, implicitHCount, implicitHCount + hydrogenCount, geom ]

+ 1 - 1
src/mol-util/debug.ts

@@ -12,7 +12,7 @@ let isProductionMode = process.env.NODE_ENV === 'production'
 
 /**
  * set to true to enable more comprehensive checks and assertions,
- * mostly used in `mol-gl`
+ * mostly used in `mol-gl` and in valence-model calculation
  */
 let isDebugMode = process.env.DEBUG === '*' || process.env.DEBUG === 'molstar'