From 610f3ba9cf4b656b8b58aef84403e2251ae46c1e Mon Sep 17 00:00:00 2001 From: Alexander Rose <alex.rose@rcsb.org> Date: Tue, 19 Mar 2019 16:20:26 -0700 Subject: [PATCH] moved isProductionMode flag to util/debug --- src/mol-task/util/user-timing.ts | 8 ++------ src/mol-util/debug.ts | 13 +++++++++++++ 2 files changed, 15 insertions(+), 6 deletions(-) create mode 100644 src/mol-util/debug.ts diff --git a/src/mol-task/util/user-timing.ts b/src/mol-task/util/user-timing.ts index a4e3b7e33..54456d65f 100644 --- a/src/mol-task/util/user-timing.ts +++ b/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}` } diff --git a/src/mol-util/debug.ts b/src/mol-util/debug.ts new file mode 100644 index 000000000..39fca88a2 --- /dev/null +++ b/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 } \ No newline at end of file -- GitLab