Skip to content

Commit

Permalink
feat: 🎸 Allow options to be passed to requestPoolManager (#1324)
Browse files Browse the repository at this point in the history
* feat: 🎸 Allow options to be passed to requestPoolManager
  • Loading branch information
JamesAPetts committed Nov 5, 2020
1 parent cf45a66 commit 18bfdf1
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions src/requestPool/requestPoolManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ function addRequest(
preventCache,
doneCallback,
failCallback,
addToBeginning
addToBeginning,
options = {}
) {
if (!requestPool.hasOwnProperty(type)) {
throw new Error(
Expand All @@ -48,6 +49,7 @@ function addRequest(
preventCache,
doneCallback,
failCallback,
options,
};

// If this imageId is in the cache, resolve it immediately
Expand Down Expand Up @@ -150,18 +152,17 @@ function sendRequest(requestDetails) {

const priority = requestTypeToLoadPriority(requestDetails);

const options = Object.assign({}, requestDetails.options, {
priority,
type: requestDetails.type,
});

let loader;

if (requestDetails.preventCache === true) {
loader = cornerstone.loadImage(imageId, {
priority,
type: requestDetails.type,
});
loader = cornerstone.loadImage(imageId, options);
} else {
loader = cornerstone.loadAndCacheImage(imageId, {
priority,
type: requestDetails.type,
});
loader = cornerstone.loadAndCacheImage(imageId, options);
}

// Load and cache the image
Expand Down

0 comments on commit 18bfdf1

Please sign in to comment.