fix(initWebWorkers): Fix duplicate slashes for web worker paths (#527)
This commit is contained in:
parent
d20492ac62
commit
bbc598323e
@ -5,19 +5,28 @@ import cornerstoneWADOImageLoader from 'cornerstone-wado-image-loader';
|
|||||||
* @param {String} baseDirectory
|
* @param {String} baseDirectory
|
||||||
* @param {String} webWorkScriptsPath
|
* @param {String} webWorkScriptsPath
|
||||||
*/
|
*/
|
||||||
export default function(baseDirectory, webWorkScriptsPath) {
|
export default function initWebWorkers(
|
||||||
const scriptsPath = `${window.location.protocol}//${
|
baseDirectory = '/',
|
||||||
|
webWorkScriptsPath = ''
|
||||||
|
) {
|
||||||
|
let scriptsPath = `${window.location.protocol}//${
|
||||||
window.location.host
|
window.location.host
|
||||||
}${baseDirectory}/${webWorkScriptsPath}`;
|
}${baseDirectory}${webWorkScriptsPath}`;
|
||||||
|
|
||||||
|
// Ensure the last character is a slash
|
||||||
|
if (scriptsPath[scriptsPath.length - 1] !== '/') {
|
||||||
|
scriptsPath += '/';
|
||||||
|
}
|
||||||
|
|
||||||
const config = {
|
const config = {
|
||||||
maxWebWorkers: Math.max(navigator.hardwareConcurrency - 1, 1),
|
maxWebWorkers: Math.max(navigator.hardwareConcurrency - 1, 1),
|
||||||
startWebWorkersOnDemand: true,
|
startWebWorkersOnDemand: true,
|
||||||
webWorkerPath: `${scriptsPath}/cornerstoneWADOImageLoaderWebWorker.min.js`,
|
webWorkerPath: `${scriptsPath}cornerstoneWADOImageLoaderWebWorker.min.js`,
|
||||||
taskConfiguration: {
|
taskConfiguration: {
|
||||||
decodeTask: {
|
decodeTask: {
|
||||||
loadCodecsOnStartup: true,
|
loadCodecsOnStartup: true,
|
||||||
initializeCodecsOnStartup: false,
|
initializeCodecsOnStartup: false,
|
||||||
codecsPath: `${scriptsPath}/cornerstoneWADOImageLoaderCodecs.min.js`,
|
codecsPath: `${scriptsPath}cornerstoneWADOImageLoaderCodecs.min.js`,
|
||||||
usePDFJS: false,
|
usePDFJS: false,
|
||||||
strict: false,
|
strict: false,
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user