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
@@ -4,7 +4,7 @@ import {
|
||||
Synchronizer,
|
||||
} from '@cornerstonejs/tools';
|
||||
|
||||
import { pubSubServiceInterface } from '@ohif/core';
|
||||
import { pubSubServiceInterface, Types, ServicesManager } from '@ohif/core';
|
||||
|
||||
const EVENTS = {
|
||||
TOOL_GROUP_CREATED: 'event::cornerstone::syncgroupservice:toolgroupcreated',
|
||||
@@ -37,7 +37,17 @@ const asSyncGroup = (syncGroup: string | SyncGroup): SyncGroup =>
|
||||
typeof syncGroup === 'string' ? { type: syncGroup } : syncGroup;
|
||||
|
||||
export default class SyncGroupService {
|
||||
serviceManager: any;
|
||||
static REGISTRATION = {
|
||||
name: 'syncGroupService',
|
||||
altName: 'SyncGroupService',
|
||||
create: ({
|
||||
servicesManager,
|
||||
}: Types.Extensions.ExtensionParams): SyncGroupService => {
|
||||
return new SyncGroupService(servicesManager);
|
||||
},
|
||||
};
|
||||
|
||||
servicesManager: ServicesManager;
|
||||
listeners: { [key: string]: (...args: any[]) => void } = {};
|
||||
EVENTS: { [key: string]: string };
|
||||
synchronizerCreators: Record<string, SyncCreator> = {
|
||||
@@ -47,8 +57,8 @@ export default class SyncGroupService {
|
||||
[STACKIMAGE]: synchronizers.createStackImageSynchronizer,
|
||||
};
|
||||
|
||||
constructor(serviceManager) {
|
||||
this.serviceManager = serviceManager;
|
||||
constructor(serviceManager: ServicesManager) {
|
||||
this.servicesManager = serviceManager;
|
||||
this.listeners = {};
|
||||
this.EVENTS = EVENTS;
|
||||
//
|
||||
|
||||
@@ -1,11 +1,3 @@
|
||||
import SyncGroupService from './SyncGroupService';
|
||||
|
||||
export default function ExtendedSyncGroupService(serviceManager) {
|
||||
return {
|
||||
altName: 'SyncGroupService',
|
||||
name: 'syncGroupService',
|
||||
create: ({ configuration = {} }) => {
|
||||
return new SyncGroupService(serviceManager);
|
||||
},
|
||||
};
|
||||
}
|
||||
export default SyncGroupService;
|
||||
Reference in new issue
Block a user