2024-11-06 13:15:27 +01:00
|
|
|
import OHIF, { errorHandler } from '@ohif/core';
|
2022-11-16 20:19:52 +01:00
|
|
|
import React from 'react';
|
2022-07-27 18:39:04 +02:00
|
|
|
|
|
|
|
|
import * as cornerstone from '@cornerstonejs/core';
|
|
|
|
|
import * as cornerstoneTools from '@cornerstonejs/tools';
|
|
|
|
|
import {
|
|
|
|
|
init as cs3DInit,
|
|
|
|
|
eventTarget,
|
|
|
|
|
EVENTS,
|
|
|
|
|
metaData,
|
|
|
|
|
volumeLoader,
|
|
|
|
|
imageLoadPoolManager,
|
2024-01-22 15:44:35 +01:00
|
|
|
getEnabledElement,
|
2022-07-27 18:39:04 +02:00
|
|
|
Settings,
|
2023-02-23 03:01:36 +01:00
|
|
|
utilities as csUtilities,
|
2022-07-27 18:39:04 +02:00
|
|
|
} from '@cornerstonejs/core';
|
2024-04-10 05:57:34 +02:00
|
|
|
import {
|
|
|
|
|
cornerstoneStreamingImageVolumeLoader,
|
|
|
|
|
cornerstoneStreamingDynamicImageVolumeLoader,
|
2024-11-06 13:15:27 +01:00
|
|
|
} from '@cornerstonejs/core/loaders';
|
|
|
|
|
|
|
|
|
|
import RequestTypes from '@cornerstonejs/core/enums/RequestType';
|
2022-07-27 18:39:04 +02:00
|
|
|
|
|
|
|
|
import initWADOImageLoader from './initWADOImageLoader';
|
|
|
|
|
import initCornerstoneTools from './initCornerstoneTools';
|
|
|
|
|
|
|
|
|
|
import { connectToolsToMeasurementService } from './initMeasurementService';
|
|
|
|
|
import initCineService from './initCineService';
|
2024-06-28 14:58:39 +02:00
|
|
|
import initStudyPrefetcherService from './initStudyPrefetcherService';
|
2022-07-27 18:39:04 +02:00
|
|
|
import interleaveCenterLoader from './utils/interleaveCenterLoader';
|
2022-12-29 17:00:13 +01:00
|
|
|
import nthLoader from './utils/nthLoader';
|
2022-07-27 18:39:04 +02:00
|
|
|
import interleaveTopToBottom from './utils/interleaveTopToBottom';
|
2023-03-22 22:45:28 +01:00
|
|
|
import initContextMenu from './initContextMenu';
|
2023-03-29 21:39:51 +02:00
|
|
|
import initDoubleClick from './initDoubleClick';
|
2023-10-03 23:01:00 +02:00
|
|
|
import initViewTiming from './utils/initViewTiming';
|
2024-04-02 15:35:30 +02:00
|
|
|
import { colormaps } from './utils/colormaps';
|
2024-11-06 13:15:27 +01:00
|
|
|
import { SegmentationRepresentations } from '@cornerstonejs/tools/enums';
|
|
|
|
|
import { useLutPresentationStore } from './stores/useLutPresentationStore';
|
|
|
|
|
import { usePositionPresentationStore } from './stores/usePositionPresentationStore';
|
|
|
|
|
import { useSegmentationPresentationStore } from './stores/useSegmentationPresentationStore';
|
2024-11-28 19:22:40 +01:00
|
|
|
import { imageRetrieveMetadataProvider } from '@cornerstonejs/core/utilities';
|
2024-04-02 15:35:30 +02:00
|
|
|
|
2024-04-10 05:57:34 +02:00
|
|
|
const { registerColormap } = csUtilities.colormap;
|
2020-09-15 03:18:46 +02:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
// TODO: Cypress tests are currently grabbing this from the window?
|
2024-07-05 19:19:42 +02:00
|
|
|
(window as any).cornerstone = cornerstone;
|
|
|
|
|
(window as any).cornerstoneTools = cornerstoneTools;
|
2019-10-09 16:23:14 +02:00
|
|
|
/**
|
|
|
|
|
*
|
|
|
|
|
*/
|
2022-07-27 18:39:04 +02:00
|
|
|
export default async function init({
|
2020-08-05 14:56:02 +02:00
|
|
|
servicesManager,
|
|
|
|
|
commandsManager,
|
2023-05-03 18:30:02 +02:00
|
|
|
extensionManager,
|
2024-11-06 13:15:27 +01:00
|
|
|
appConfig,
|
|
|
|
|
}: withAppTypes): Promise<void> {
|
2023-09-29 23:54:16 +02:00
|
|
|
// Note: this should run first before initializing the cornerstone
|
2023-10-03 16:11:32 +02:00
|
|
|
// DO NOT CHANGE THE ORDER
|
2023-09-22 15:31:45 +02:00
|
|
|
|
2023-09-29 23:54:16 +02:00
|
|
|
await cs3DInit({
|
2024-07-05 19:19:42 +02:00
|
|
|
peerImport: appConfig.peerImport,
|
2023-09-29 23:54:16 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// For debugging e2e tests that are failing on CI
|
|
|
|
|
cornerstone.setUseCPURendering(Boolean(appConfig.useCPURendering));
|
|
|
|
|
|
2023-04-01 04:21:16 +02:00
|
|
|
cornerstone.setConfiguration({
|
|
|
|
|
...cornerstone.getConfiguration(),
|
|
|
|
|
rendering: {
|
|
|
|
|
...cornerstone.getConfiguration().rendering,
|
2023-09-01 22:19:39 +02:00
|
|
|
strictZSpacingForVolumeViewport: appConfig.strictZSpacingForVolumeViewport,
|
2023-04-01 04:21:16 +02:00
|
|
|
},
|
|
|
|
|
});
|
2022-07-27 18:39:04 +02:00
|
|
|
|
2023-08-15 13:20:45 +02:00
|
|
|
// For debugging large datasets, otherwise prefer the defaults
|
|
|
|
|
const { maxCacheSize } = appConfig;
|
|
|
|
|
if (maxCacheSize) {
|
|
|
|
|
cornerstone.cache.setMaxCacheSize(maxCacheSize);
|
|
|
|
|
}
|
2022-07-27 18:39:04 +02:00
|
|
|
|
|
|
|
|
initCornerstoneTools();
|
|
|
|
|
|
2023-09-01 22:19:39 +02:00
|
|
|
Settings.getRuntimeSettings().set('useCursors', Boolean(appConfig.useCursors));
|
2022-07-27 18:39:04 +02:00
|
|
|
|
2020-07-22 19:40:40 +02:00
|
|
|
const {
|
2023-02-13 14:55:55 +01:00
|
|
|
userAuthenticationService,
|
2023-03-22 22:45:28 +01:00
|
|
|
customizationService,
|
2023-02-13 14:55:55 +01:00
|
|
|
uiModalService,
|
2023-02-10 22:46:09 +01:00
|
|
|
uiNotificationService,
|
|
|
|
|
cornerstoneViewportService,
|
|
|
|
|
hangingProtocolService,
|
|
|
|
|
viewportGridService,
|
2024-05-08 18:12:49 +02:00
|
|
|
} = servicesManager.services;
|
2020-09-15 03:18:46 +02:00
|
|
|
|
2022-11-16 20:19:52 +01:00
|
|
|
window.services = servicesManager.services;
|
2023-05-03 18:30:02 +02:00
|
|
|
window.extensionManager = extensionManager;
|
|
|
|
|
window.commandsManager = commandsManager;
|
2022-07-27 18:39:04 +02:00
|
|
|
|
2023-09-01 22:19:39 +02:00
|
|
|
if (appConfig.showCPUFallbackMessage && cornerstone.getShouldUseCPURendering()) {
|
2023-02-13 14:55:55 +01:00
|
|
|
_showCPURenderingModal(uiModalService, hangingProtocolService);
|
2022-11-16 20:19:52 +01:00
|
|
|
}
|
2024-11-06 13:15:27 +01:00
|
|
|
const { getPresentationId: getLutPresentationId } = useLutPresentationStore.getState();
|
2022-11-16 20:19:52 +01:00
|
|
|
|
2024-11-06 13:15:27 +01:00
|
|
|
const { getPresentationId: getSegmentationPresentationId } =
|
|
|
|
|
useSegmentationPresentationStore.getState();
|
2023-03-29 21:39:51 +02:00
|
|
|
|
2024-11-06 13:15:27 +01:00
|
|
|
const { getPresentationId: getPositionPresentationId } = usePositionPresentationStore.getState();
|
2024-05-29 17:56:03 +02:00
|
|
|
|
2024-11-06 13:15:27 +01:00
|
|
|
// register presentation id providers
|
|
|
|
|
viewportGridService.addPresentationIdProvider(
|
|
|
|
|
'positionPresentationId',
|
|
|
|
|
getPositionPresentationId
|
|
|
|
|
);
|
|
|
|
|
viewportGridService.addPresentationIdProvider('lutPresentationId', getLutPresentationId);
|
|
|
|
|
viewportGridService.addPresentationIdProvider(
|
|
|
|
|
'segmentationPresentationId',
|
|
|
|
|
getSegmentationPresentationId
|
|
|
|
|
);
|
2022-11-16 20:19:52 +01:00
|
|
|
|
2024-11-06 13:15:27 +01:00
|
|
|
cornerstoneTools.segmentation.config.style.setStyle(
|
|
|
|
|
{ type: SegmentationRepresentations.Contour },
|
|
|
|
|
{
|
|
|
|
|
renderFill: false,
|
|
|
|
|
}
|
|
|
|
|
);
|
2024-05-29 17:56:03 +02:00
|
|
|
|
2022-11-16 20:19:52 +01:00
|
|
|
const metadataProvider = OHIF.classes.MetadataProvider;
|
|
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
volumeLoader.registerVolumeLoader(
|
|
|
|
|
'cornerstoneStreamingImageVolume',
|
|
|
|
|
cornerstoneStreamingImageVolumeLoader
|
|
|
|
|
);
|
|
|
|
|
|
2024-04-10 05:57:34 +02:00
|
|
|
volumeLoader.registerVolumeLoader(
|
|
|
|
|
'cornerstoneStreamingDynamicImageVolume',
|
|
|
|
|
cornerstoneStreamingDynamicImageVolumeLoader
|
|
|
|
|
);
|
|
|
|
|
|
2024-11-28 19:22:40 +01:00
|
|
|
// Register strategies using the wrapper
|
|
|
|
|
const imageLoadStrategies = {
|
|
|
|
|
interleaveCenter: interleaveCenterLoader,
|
|
|
|
|
interleaveTopToBottom: interleaveTopToBottom,
|
|
|
|
|
nth: nthLoader,
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
Object.entries(imageLoadStrategies).forEach(([name, strategyFn]) => {
|
|
|
|
|
hangingProtocolService.registerImageLoadStrategy(
|
|
|
|
|
name,
|
|
|
|
|
createMetadataWrappedStrategy(strategyFn)
|
|
|
|
|
);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
// ... existing code ...
|
2022-07-27 18:39:04 +02:00
|
|
|
|
2023-02-23 03:01:36 +01:00
|
|
|
// add metadata providers
|
|
|
|
|
metaData.addProvider(
|
|
|
|
|
csUtilities.calibratedPixelSpacingMetadataProvider.get.bind(
|
|
|
|
|
csUtilities.calibratedPixelSpacingMetadataProvider
|
|
|
|
|
)
|
|
|
|
|
); // this provider is required for Calibration tool
|
2022-07-27 18:39:04 +02:00
|
|
|
metaData.addProvider(metadataProvider.get.bind(metadataProvider), 9999);
|
|
|
|
|
|
2024-07-05 18:33:07 +02:00
|
|
|
// These are set reasonably low to allow for interleaved retrieves and slower
|
|
|
|
|
// connections.
|
2022-07-27 18:39:04 +02:00
|
|
|
imageLoadPoolManager.maxNumRequests = {
|
2024-11-06 13:15:27 +01:00
|
|
|
[RequestTypes.Interaction]: appConfig?.maxNumRequests?.interaction || 10,
|
|
|
|
|
[RequestTypes.Thumbnail]: appConfig?.maxNumRequests?.thumbnail || 5,
|
|
|
|
|
[RequestTypes.Prefetch]: appConfig?.maxNumRequests?.prefetch || 5,
|
|
|
|
|
[RequestTypes.Compute]: appConfig?.maxNumRequests?.compute || 10,
|
2022-07-27 18:39:04 +02:00
|
|
|
};
|
|
|
|
|
|
2023-06-01 23:18:54 +02:00
|
|
|
initWADOImageLoader(userAuthenticationService, appConfig, extensionManager);
|
2019-12-09 18:47:23 +01:00
|
|
|
|
2020-08-05 14:56:02 +02:00
|
|
|
/* Measurement Service */
|
2023-09-01 22:19:39 +02:00
|
|
|
this.measurementServiceSource = connectToolsToMeasurementService(servicesManager);
|
2020-08-05 14:56:02 +02:00
|
|
|
|
2024-04-10 05:57:34 +02:00
|
|
|
initCineService(servicesManager);
|
2024-06-28 14:58:39 +02:00
|
|
|
initStudyPrefetcherService(servicesManager);
|
2022-07-27 18:39:04 +02:00
|
|
|
|
|
|
|
|
// When a custom image load is performed, update the relevant viewports
|
2023-02-10 22:46:09 +01:00
|
|
|
hangingProtocolService.subscribe(
|
|
|
|
|
hangingProtocolService.EVENTS.CUSTOM_IMAGE_LOAD_PERFORMED,
|
2022-07-27 18:39:04 +02:00
|
|
|
volumeInputArrayMap => {
|
2024-11-06 13:15:27 +01:00
|
|
|
const { lutPresentationStore } = useLutPresentationStore.getState();
|
|
|
|
|
const { segmentationPresentationStore } = useSegmentationPresentationStore.getState();
|
|
|
|
|
const { positionPresentationStore } = usePositionPresentationStore.getState();
|
|
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
for (const entry of volumeInputArrayMap.entries()) {
|
|
|
|
|
const [viewportId, volumeInputArray] = entry;
|
2023-09-01 22:19:39 +02:00
|
|
|
const viewport = cornerstoneViewportService.getCornerstoneViewport(viewportId);
|
|
|
|
|
|
|
|
|
|
const ohifViewport = cornerstoneViewportService.getViewportInfo(viewportId);
|
|
|
|
|
|
2023-03-29 15:40:22 +02:00
|
|
|
const { presentationIds } = ohifViewport.getViewportOptions();
|
2024-11-06 13:15:27 +01:00
|
|
|
|
2023-03-29 15:40:22 +02:00
|
|
|
const presentations = {
|
2023-09-01 22:19:39 +02:00
|
|
|
positionPresentation: positionPresentationStore[presentationIds?.positionPresentationId],
|
|
|
|
|
lutPresentation: lutPresentationStore[presentationIds?.lutPresentationId],
|
2024-11-06 13:15:27 +01:00
|
|
|
segmentationPresentation:
|
|
|
|
|
segmentationPresentationStore[presentationIds?.segmentationPresentationId],
|
2023-03-29 15:40:22 +02:00
|
|
|
};
|
|
|
|
|
|
2023-09-01 22:19:39 +02:00
|
|
|
cornerstoneViewportService.setVolumesForViewport(viewport, volumeInputArray, presentations);
|
2022-07-27 18:39:04 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
2024-02-21 19:49:23 +01:00
|
|
|
// resize the cornerstone viewport service when the grid size changes
|
|
|
|
|
// IMPORTANT: this should happen outside of the OHIFCornerstoneViewport
|
|
|
|
|
// since it will trigger a rerender of each viewport and each resizing
|
|
|
|
|
// the offscreen canvas which would result in a performance hit, this should
|
|
|
|
|
// done only once per grid resize here. Doing it once here, allows us to reduce
|
|
|
|
|
// the refreshRage(in ms) to 10 from 50. I tried with even 1 or 5 ms it worked fine
|
|
|
|
|
viewportGridService.subscribe(viewportGridService.EVENTS.GRID_SIZE_CHANGED, () => {
|
|
|
|
|
cornerstoneViewportService.resize(true);
|
|
|
|
|
});
|
|
|
|
|
|
2023-03-22 22:45:28 +01:00
|
|
|
initContextMenu({
|
|
|
|
|
cornerstoneViewportService,
|
|
|
|
|
customizationService,
|
|
|
|
|
commandsManager,
|
|
|
|
|
});
|
2020-08-05 14:56:02 +02:00
|
|
|
|
2023-03-29 21:39:51 +02:00
|
|
|
initDoubleClick({
|
|
|
|
|
customizationService,
|
|
|
|
|
commandsManager,
|
|
|
|
|
});
|
|
|
|
|
|
2023-11-13 16:42:55 +01:00
|
|
|
/**
|
|
|
|
|
* Runs error handler for failed requests.
|
2024-01-09 16:15:56 +01:00
|
|
|
* @param event
|
2023-11-13 16:42:55 +01:00
|
|
|
*/
|
|
|
|
|
const imageLoadFailedHandler = ({ detail }) => {
|
2024-01-09 16:15:56 +01:00
|
|
|
const handler = errorHandler.getHTTPErrorHandler();
|
2023-11-13 16:42:55 +01:00
|
|
|
handler(detail.error);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
eventTarget.addEventListener(EVENTS.IMAGE_LOAD_FAILED, imageLoadFailedHandler);
|
|
|
|
|
eventTarget.addEventListener(EVENTS.IMAGE_LOAD_ERROR, imageLoadFailedHandler);
|
2024-01-09 16:15:56 +01:00
|
|
|
|
2022-07-27 18:39:04 +02:00
|
|
|
function elementEnabledHandler(evt) {
|
|
|
|
|
const { element } = evt.detail;
|
2023-11-13 16:42:55 +01:00
|
|
|
|
2024-03-27 21:01:32 +01:00
|
|
|
element.addEventListener(EVENTS.CAMERA_RESET, evt => {
|
|
|
|
|
const { element } = evt.detail;
|
2024-05-21 23:23:18 +02:00
|
|
|
const enabledElement = getEnabledElement(element);
|
|
|
|
|
if (!enabledElement) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
const { viewportId } = enabledElement;
|
2024-03-27 21:01:32 +01:00
|
|
|
commandsManager.runCommand('resetCrosshairs', { viewportId });
|
|
|
|
|
});
|
2022-11-16 20:19:52 +01:00
|
|
|
|
2024-03-27 21:01:32 +01:00
|
|
|
initViewTiming({ element });
|
2020-08-05 14:56:02 +02:00
|
|
|
}
|
|
|
|
|
|
2023-09-01 22:19:39 +02:00
|
|
|
eventTarget.addEventListener(EVENTS.ELEMENT_ENABLED, elementEnabledHandler.bind(null));
|
2020-07-03 18:39:41 +02:00
|
|
|
|
2024-04-02 15:35:30 +02:00
|
|
|
colormaps.forEach(registerColormap);
|
2024-04-16 17:04:48 +02:00
|
|
|
|
|
|
|
|
// Event listener
|
2024-04-19 21:11:31 +02:00
|
|
|
eventTarget.addEventListenerDebounced(
|
|
|
|
|
EVENTS.ERROR_EVENT,
|
|
|
|
|
({ detail }) => {
|
|
|
|
|
uiNotificationService.show({
|
|
|
|
|
title: detail.type,
|
|
|
|
|
message: detail.message,
|
|
|
|
|
type: 'error',
|
|
|
|
|
});
|
|
|
|
|
},
|
2024-11-06 13:15:27 +01:00
|
|
|
100
|
2024-04-19 21:11:31 +02:00
|
|
|
);
|
2024-11-06 13:15:27 +01:00
|
|
|
|
|
|
|
|
// Call this function when initializing
|
|
|
|
|
initializeWebWorkerProgressHandler(servicesManager.services.uiNotificationService);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function initializeWebWorkerProgressHandler(uiNotificationService) {
|
|
|
|
|
const activeToasts = new Map();
|
|
|
|
|
|
|
|
|
|
eventTarget.addEventListener(EVENTS.WEB_WORKER_PROGRESS, ({ detail }) => {
|
|
|
|
|
const { progress, type, id } = detail;
|
|
|
|
|
|
|
|
|
|
const cacheKey = `${type}-${id}`;
|
|
|
|
|
if (progress === 0 && !activeToasts.has(cacheKey)) {
|
|
|
|
|
const progressPromise = new Promise((resolve, reject) => {
|
|
|
|
|
activeToasts.set(cacheKey, { resolve, reject });
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
uiNotificationService.show({
|
|
|
|
|
id: cacheKey,
|
|
|
|
|
title: `${type}`,
|
|
|
|
|
message: `${type}: ${progress}%`,
|
|
|
|
|
autoClose: false,
|
|
|
|
|
promise: progressPromise,
|
|
|
|
|
promiseMessages: {
|
|
|
|
|
loading: `Computing...`,
|
|
|
|
|
success: `Completed successfully`,
|
|
|
|
|
error: 'Web Worker failed',
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
if (progress === 100) {
|
|
|
|
|
const { resolve } = activeToasts.get(cacheKey);
|
|
|
|
|
resolve({ progress, type });
|
|
|
|
|
activeToasts.delete(cacheKey);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2023-11-03 17:19:24 +01:00
|
|
|
}
|
2022-11-16 20:19:52 +01:00
|
|
|
|
2024-11-28 19:22:40 +01:00
|
|
|
/**
|
|
|
|
|
* Creates a wrapped image load strategy with metadata handling
|
|
|
|
|
* @param strategyFn - The image loading strategy function to wrap
|
|
|
|
|
* @returns A wrapped strategy function that handles metadata configuration
|
|
|
|
|
*/
|
|
|
|
|
const createMetadataWrappedStrategy = (strategyFn: (args: any) => any) => {
|
|
|
|
|
return (args: any) => {
|
|
|
|
|
const clonedConfig = imageRetrieveMetadataProvider.clone();
|
|
|
|
|
imageRetrieveMetadataProvider.clear();
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
const result = strategyFn(args);
|
|
|
|
|
return result;
|
|
|
|
|
} finally {
|
|
|
|
|
// Ensure metadata is always restored, even if there's an error
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
imageRetrieveMetadataProvider.restore(clonedConfig);
|
|
|
|
|
}, 10);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
};
|
|
|
|
|
|
2022-11-16 20:19:52 +01:00
|
|
|
function CPUModal() {
|
|
|
|
|
return (
|
|
|
|
|
<div>
|
|
|
|
|
<p>
|
2023-09-01 22:19:39 +02:00
|
|
|
Your computer does not have enough GPU power to support the default GPU rendering mode. OHIF
|
|
|
|
|
has switched to CPU rendering mode. Please note that CPU rendering does not support all
|
|
|
|
|
features such as Volume Rendering, Multiplanar Reconstruction, and Segmentation Overlays.
|
2022-11-16 20:19:52 +01:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
2023-02-13 14:55:55 +01:00
|
|
|
function _showCPURenderingModal(uiModalService, hangingProtocolService) {
|
2022-11-16 20:19:52 +01:00
|
|
|
const callback = progress => {
|
|
|
|
|
if (progress === 100) {
|
2023-02-13 14:55:55 +01:00
|
|
|
uiModalService.show({
|
2022-11-16 20:19:52 +01:00
|
|
|
content: CPUModal,
|
|
|
|
|
title: 'OHIF Fell Back to CPU Rendering',
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2023-02-10 22:46:09 +01:00
|
|
|
const { unsubscribe } = hangingProtocolService.subscribe(
|
2023-03-15 17:41:41 +01:00
|
|
|
hangingProtocolService.EVENTS.PROTOCOL_CHANGED,
|
|
|
|
|
() => {
|
|
|
|
|
const done = callback(100);
|
2022-11-16 20:19:52 +01:00
|
|
|
|
|
|
|
|
if (done) {
|
|
|
|
|
unsubscribe();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
);
|
2020-09-15 03:18:46 +02:00
|
|
|
}
|