ohif-viewer/docs/latest/services/data/index.md
Alireza 5643f8f6d2
feat: Added documentation for OHIF-v3 (#2450)
* Added docs with new screenshots

* Added doc to architecture

* Added documentations to various extension modules

* Added more documentation to modes

* Added docs to managers

* Added docs for services

* Fixed deployment docs

* Added white labelling documentation

* Added i18n docs and measurement export
2021-06-15 11:15:29 -04:00

1.8 KiB

Services (default)

Overview

Data services are the first category of services which deal with handling non-ui related state Each services have their own internal state which they handle.

We have replaced the redux store. Instead we have introduced various services and a pub/sub pattern to subscribe and run, which makes the OHIF-v3 architecture nice and clean.

We maintain the following non-ui Services:

Service Architecture

services-data

We have explained services and how to create a custom service in the ServiceManager section of the docs

To recap: The simplest service return a new object that has a name property, and Create method which instantiate the service class. The "Factory Function" that creates the service is provided with the implementation (this is slightly different for UI Services).

// extensions/customExtension/src/services/backEndService/index.js
import backEndService from './backEndService';

export default function WrappedBackEndService(serviceManager) {
  return {
    name: 'myService',
    create: ({ configuration = {} }) => {
      return new backEndService(serviceManager);
    },
  };
}

A service, once created, can be registered with the ServicesManager to make it accessible to extensions. Similarly, the application code can access named services from the ServicesManager.

Read more of how to design a new custom service and register it