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

View File

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

View File

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