diff --git a/Packages/ohif-core/both/utils/absoluteUrl.js b/Packages/ohif-core/both/utils/absoluteUrl.js new file mode 100644 index 000000000..f695e2269 --- /dev/null +++ b/Packages/ohif-core/both/utils/absoluteUrl.js @@ -0,0 +1,11 @@ +import { OHIF } from 'meteor/ohif:core'; + +// Return an absolute URL with the given path by supporting the leading "/" +OHIF.utils.absoluteUrl = function(path) { + if (path) { + // Remove the leading "/" + path = path.replace(/^\//, ''); + } + + return Meteor.absoluteUrl(path); +}; \ No newline at end of file diff --git a/Packages/ohif-core/both/utils/index.js b/Packages/ohif-core/both/utils/index.js index c1ac814cf..444f24e49 100644 --- a/Packages/ohif-core/both/utils/index.js +++ b/Packages/ohif-core/both/utils/index.js @@ -1 +1,2 @@ +import './absoluteUrl'; import './objectPath'; diff --git a/Packages/ohif-core/client/lib/utils.js b/Packages/ohif-core/client/lib/utils.js index 09ba5aca8..7bd90c660 100644 --- a/Packages/ohif-core/client/lib/utils.js +++ b/Packages/ohif-core/client/lib/utils.js @@ -1,11 +1,5 @@ import { OHIF } from 'meteor/ohif:core'; -// Return an absolute URL with the given path by supporting the leading "/" -OHIF.utils.absoluteUrl = function(path) { - path = path.replace(/^\//, ''); - return Meteor.absoluteUrl(path); -}; - // Return the array sorting function for its object's properties OHIF.utils.sortBy = function() { var fields = [].slice.call(arguments), diff --git a/StandaloneViewer/StandaloneViewer/client/config.js b/StandaloneViewer/StandaloneViewer/client/config.js index ce8c5a6fd..dba72a935 100644 --- a/StandaloneViewer/StandaloneViewer/client/config.js +++ b/StandaloneViewer/StandaloneViewer/client/config.js @@ -1,4 +1,5 @@ import { Meteor } from 'meteor/meteor'; +import { OHIF } from 'meteor/ohif:core'; import { cornerstoneWADOImageLoader } from 'meteor/ohif:cornerstone'; Meteor.startup(function() { @@ -6,12 +7,12 @@ Meteor.startup(function() { const config = { maxWebWorkers: maxWebWorkers, startWebWorkersOnDemand: true, - webWorkerPath : Meteor.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js'), + webWorkerPath : OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderWebWorker.es5.js'), taskConfiguration: { 'decodeTask' : { loadCodecsOnStartup : true, initializeCodecsOnStartup: false, - codecsPath: Meteor.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderCodecs.es5.js'), + codecsPath: OHIF.utils.absoluteUrl('packages/ohif_cornerstone/public/js/cornerstoneWADOImageLoaderCodecs.es5.js'), usePDFJS: false } }