From dda43370cf377f95220b95b63c861a23003a6653 Mon Sep 17 00:00:00 2001
From: Alexander Rose <alexander.rose@weirdbyte.de>
Date: Fri, 8 May 2020 10:42:38 -0700
Subject: [PATCH] add setProductionMode, setDebugMode exports
---
src/apps/viewer/index.ts | 2 ++
src/mol-util/debug.ts | 17 ++++++++---------
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/apps/viewer/index.ts b/src/apps/viewer/index.ts
index e7d5ef273..9b8943b41 100644
--- a/src/apps/viewer/index.ts
+++ b/src/apps/viewer/index.ts
@@ -23,9 +23,11 @@ import { ObjectKeys } from '../../mol-util/type-helpers';
import { PluginState } from '../../mol-plugin/state';
import { DownloadDensity } from '../../mol-plugin-state/actions/volume';
import { PluginLayoutControlsDisplay } from '../../mol-plugin/layout';
+
require('mol-plugin-ui/skin/light.scss');
export { PLUGIN_VERSION as version } from '../../mol-plugin/version';
+export { setProductionMode, setDebugMode } from '../../mol-util/debug';
const Extensions = {
'cellpack': PluginSpec.Behavior(CellPack),
diff --git a/src/mol-util/debug.ts b/src/mol-util/debug.ts
index e9c40765f..b96d6fb06 100644
--- a/src/mol-util/debug.ts
+++ b/src/mol-util/debug.ts
@@ -1,5 +1,5 @@
/**
- * Copyright (c) 2019 mol* contributors, licensed under MIT, See LICENSE file for more info.
+ * Copyright (c) 2019-2020 mol* contributors, licensed under MIT, See LICENSE file for more info.
*
* @author Alexander Rose <alexander.rose@weirdbyte.de>
*/
@@ -16,13 +16,12 @@ let isProductionMode = process.env.NODE_ENV === 'production';
*/
let isDebugMode = process.env.DEBUG === '*' || process.env.DEBUG === 'molstar';
-if (typeof window !== 'undefined' && !(window as any).setMolStarDebugMode) {
- try {
- (window as any).setMolStarDebugMode = function setMolStarDebugMode(isDebug?: boolean, isProduction?: boolean) {
- if (typeof isDebug !== 'undefined') isDebugMode = isDebug;
- if (typeof isProduction !== 'undefined') isProductionMode = isProduction;
- };
- } catch { }
+export { isProductionMode, isDebugMode };
+
+export function setProductionMode(value?: boolean) {
+ if (typeof value !== 'undefined') isProductionMode = value;
}
-export { isProductionMode, isDebugMode };
\ No newline at end of file
+export function setDebugMode(value?: boolean) {
+ if (typeof value !== 'undefined') isDebugMode = value;
+}
\ No newline at end of file
--
GitLab