ohif-viewer/src/components/StudyPrefetcher.js

30 lines
620 B
JavaScript
Raw Normal View History

2019-05-29 14:39:54 +02:00
import { Component } from 'react';
import PropTypes from 'prop-types';
import OHIF from 'ohif-core';
const { StudyPrefetcher } = OHIF.classes;
class StudyPrefetcherComponent extends Component {
2019-05-29 14:39:54 +02:00
static propTypes = {
studies: PropTypes.array,
};
2019-05-29 14:39:54 +02:00
componentDidMount() {
const { studies } = this.props;
2019-05-29 14:39:54 +02:00
this.studyPrefetcher = StudyPrefetcher.getInstance();
this.studyPrefetcher.setStudies(studies);
}
2019-05-29 14:39:54 +02:00
render() {
return null;
}
2019-05-29 14:39:54 +02:00
componentWillUnmount() {
// Stop prefetching when we close the viewer
this.studyPrefetcher.destroy();
}
}
export default StudyPrefetcherComponent;