Explorar el Código

add setProductionMode, setDebugMode exports

Alexander Rose hace 4 años
padre
commit
dda43370cf
Se han modificado 2 ficheros con 10 adiciones y 9 borrados
  1. 2 0
      src/apps/viewer/index.ts
  2. 8 9
      src/mol-util/debug.ts

+ 2 - 0
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),

+ 8 - 9
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 };
+export function setDebugMode(value?: boolean) {
+    if (typeof value !== 'undefined') isDebugMode = value;
+}