fix(config): Stop crashes if window.config is not defined when script-tag viewer is loaded

This commit is contained in:
Erik Ziegler 2019-07-29 14:28:46 +02:00
parent c5f532159b
commit 02c732aa15
3 changed files with 3 additions and 7 deletions

View File

@ -25,12 +25,11 @@
<div id="root"></div> <div id="root"></div>
<script src="/dist/index.umd.js" crossorigin></script>
<script> <script>
window.config = { window.config = {
// default: '/' // default: '/'
routerBasename: '/', routerBasename: '/',
// default: ''
relativeWebWorkerScriptsPath: '',
servers: { servers: {
dicomWeb: [ dicomWeb: [
{ {
@ -45,10 +44,7 @@
], ],
}, },
} }
</script>
<script src="/dist/index.umd.js" crossorigin></script>
<script>
window.OHIFStandaloneViewer.installViewer(window.config); window.OHIFStandaloneViewer.installViewer(window.config);
</script> </script>
</body> </body>

View File

@ -72,7 +72,7 @@ extensionManager.registerExtensions([
]); ]);
// Must run after extension commands are registered // Must run after extension commands are registered
if (window.config.hotkeys) { if (window.config && window.config.hotkeys) {
hotkeysManager.setHotkeys(window.config.hotkeys, true); hotkeysManager.setHotkeys(window.config.hotkeys, true);
} }

View File

@ -136,7 +136,7 @@ class OHIFStandaloneViewer extends Component {
]; ];
const showStudyList = const showStudyList =
window.config.showStudyList !== undefined window.config && window.config.showStudyList !== undefined
? window.config.showStudyList ? window.config.showStudyList
: true; : true;
if (showStudyList) { if (showStudyList) {