Browse Source

moved isProductionMode flag to util/debug

Alexander Rose 6 years ago
parent
commit
610f3ba9cf
2 changed files with 15 additions and 6 deletions
  1. 2 6
      src/mol-task/util/user-timing.ts
  2. 13 0
      src/mol-util/debug.ts

+ 2 - 6
src/mol-task/util/user-timing.ts

@@ -5,14 +5,10 @@
  */
 
 import { Task } from '../task'
+import { isProductionMode } from 'mol-util/debug';
 
 const hasPerformance = typeof performance !== 'undefined'
-/**
- * on node `process.env.NODE_ENV` is available, in webpack build it is automatically set
- * by the DefinePlugin to the webpack `mode` value
- */
-const productionMode = process.env.NODE_ENV === 'production'
-const timingEnabled = hasPerformance && !productionMode
+const timingEnabled = hasPerformance && !isProductionMode
 
 export namespace UserTiming {
     function startMarkName(task: Task<any>) { return `startTask${task.id}` }

+ 13 - 0
src/mol-util/debug.ts

@@ -0,0 +1,13 @@
+/**
+ * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ *
+ * @author Alexander Rose <alexander.rose@weirdbyte.de>
+ */
+
+/**
+ * on node `process.env.NODE_ENV` is available, in webpack build it is automatically set
+ * by the DefinePlugin to the webpack `mode` value
+ */
+const isProductionMode = process.env.NODE_ENV === 'production'
+
+export { isProductionMode }