fix: Service consistency typing (#3309)
* Use more consistent type/structure for services * Fix restoring SR so the tests described work * One more typed service * Added types for the Cornerstone library * Couple more type fixes
This commit is contained in:
1 parent
47c25f4364
commit
6cf271d006
24 files changed
+309
-299
No files matched your search
@@ -1,5 +1,6 @@
|
||||
import cloneDeep from 'lodash.clonedeep';
|
||||
|
||||
import { Types as OhifTypes, ServicesManager, PubSubService } from '@ohif/core';
|
||||
import {
|
||||
cache,
|
||||
eventTarget,
|
||||
@@ -16,7 +17,6 @@ import {
|
||||
Types as cstTypes,
|
||||
utilities as cstUtils,
|
||||
} from '@cornerstonejs/tools';
|
||||
import { pubSubServiceInterface } from '@ohif/core';
|
||||
import isEqual from 'lodash.isequal';
|
||||
import { easeInOutBell } from '../../utils/transitions';
|
||||
import {
|
||||
@@ -47,19 +47,26 @@ const EVENTS = {
|
||||
|
||||
const VALUE_TYPES = {};
|
||||
|
||||
class SegmentationService {
|
||||
listeners = {};
|
||||
class SegmentationService extends PubSubService {
|
||||
static REGISTRATION = {
|
||||
name: 'segmentationService',
|
||||
altName: 'SegmentationService',
|
||||
create: ({
|
||||
servicesManager,
|
||||
}: OhifTypes.Extensions.ExtensionParams): SegmentationService => {
|
||||
return new SegmentationService({ servicesManager });
|
||||
},
|
||||
};
|
||||
|
||||
segmentations: Record<string, Segmentation>;
|
||||
servicesManager = null;
|
||||
readonly servicesManager: ServicesManager;
|
||||
highlightIntervalId = null;
|
||||
_broadcastEvent: (eventName: string, callbackProps: any) => void;
|
||||
readonly EVENTS = EVENTS;
|
||||
|
||||
constructor({ servicesManager }) {
|
||||
super(EVENTS);
|
||||
this.segmentations = {};
|
||||
this.listeners = {};
|
||||
|
||||
Object.assign(this, pubSubServiceInterface);
|
||||
this.servicesManager = servicesManager;
|
||||
|
||||
this._initSegmentationService();
|
||||
|
||||
Reference in new issue
Block a user