Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 1x 1x 1x 1x 1x | import { RequestPoolManager } from './requestPoolManager';
import RequestType from '../enums/RequestType';
/**
* You can use the imageLoadPoolManager to load images, by providing a `requestFn`
* that returns a promise for the image. You can provide a `type` to specify the type of
* request (interaction, thumbnail, prefetch), and you can provide additional details
* that will be passed to the requestFn. Below is an example of a requestFn that loads
* an image from an imageId:
*
* ```javascript
*
* const priority = -5
* const requestType = RequestType.Interaction
* const additionalDetails = { imageId }
* const options = {
* targetBuffer: {
* type: 'Float32Array',
* offset: null,
* length: null,
* },
* preScale: {
* enabled: true,
* },
* }
*
* imageLoadPoolManager.addRequest(
* loadAndCacheImage(imageId, options).then(() => { // set on viewport}),
* requestType,
* additionalDetails,
* priority
* )
* ```
*/
const imageLoadPoolManager = new RequestPoolManager('imageLoadPool');
imageLoadPoolManager.grabDelay = 0;
imageLoadPoolManager.setMaxSimultaneousRequests(RequestType.Interaction, 1000);
imageLoadPoolManager.setMaxSimultaneousRequests(RequestType.Thumbnail, 1000);
imageLoadPoolManager.setMaxSimultaneousRequests(RequestType.Prefetch, 1000);
export default imageLoadPoolManager;
|