diff --git a/src/mol-task/util/user-timing.ts b/src/mol-task/util/user-timing.ts index a4e3b7e33808f2dad86b1c59c929a85dda08a550..54456d65fa3b1cecce102d16b8ac492f297d15b7 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 0000000000000000000000000000000000000000..39fca88a29dad4c7408388f4f8e9505c6e077773 --- /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