Skip to content

Commit

Permalink
Add custom Media Types support in StudyPrefetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
Triet Cao committed Dec 7, 2020
1 parent 5c10933 commit bbfb00a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 4 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).


## [1.1.7] - 2020-12-07
### Added
- Add custom Media Types support in StudyPrefetcher - [@triet12369]

## [1.1.6] - 2020-10-19
### Added
- Add custom StudyInstanceUID to bulkData fetch - [@triet12369]
Expand Down
2 changes: 1 addition & 1 deletion dist/index.umd.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/index.umd.js.map

Large diffs are not rendered by default.

12 changes: 10 additions & 2 deletions src/classes/StudyPrefetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ import log from '../log';
import getImageId from '../utils/getImageId';

export class StudyPrefetcher {
constructor(studies) {
constructor(studies, options = {}) {
this.studies = studies || [];
this.prefetchDisplaySetsTimeout = 300;
this.lastActiveViewportElement = null;
this.options = options;

cornerstone.events.addEventListener(
'cornerstoneimagecachefull.StudyPrefetcher',
Expand Down Expand Up @@ -36,6 +37,10 @@ export class StudyPrefetcher {
this.studies = studies;
}

setOptions(options) {
this.options = options;
}

prefetch() {
if (!this.studies || !this.studies.length) {
return;
Expand Down Expand Up @@ -76,6 +81,7 @@ export class StudyPrefetcher {
const requestPoolManager = cornerstoneTools.requestPoolManager;
const requestType = 'prefetch';
const preventCache = false;
const mediaType = this.options.mediaType;
const noop = () => {
};

Expand All @@ -86,7 +92,9 @@ export class StudyPrefetcher {
requestType,
preventCache,
noop,
noop
noop,
false,
mediaType
);
});

Expand Down

0 comments on commit bbfb00a

Please sign in to comment.