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
This commit is contained in:
1 parent
1bf651e763
commit
5643f8f6d2
142 files changed
+5251
-1523
No files matched your search
@@ -0,0 +1,29 @@
|
||||
# Lifecycle Hook: onModeEnter
|
||||
|
||||
If an extension defines the `onModeEnter` lifecycle hook, it is called
|
||||
when a new mode is enters, or a mode's data or datasource is switched.
|
||||
|
||||
For instance, in DICOM structured report extension (`dicom-sr`), we are using
|
||||
`onModeEnter` to re-create the displaySets after a new mode is entered.
|
||||
|
||||
_Example `onModeEnter` hook implementation_
|
||||
|
||||
```js
|
||||
export default {
|
||||
id: 'org.ohif.dicom-sr',
|
||||
|
||||
onModeEnter({ servicesManager}) {
|
||||
const { DisplaySetService } = servicesManager.services;
|
||||
const displaySetCache = DisplaySetService.getDisplaySetCache();
|
||||
|
||||
const srDisplaySets = displaySetCache.filter(
|
||||
ds => ds.SOPClassHandlerId === SOPClassHandlerId
|
||||
);
|
||||
|
||||
srDisplaySets.forEach(ds => {
|
||||
// New mode route, allow SRs to be hydrated again
|
||||
ds.isHydrated = false;
|
||||
});
|
||||
},
|
||||
};
|
||||
```
|
||||
@@ -0,0 +1,17 @@
|
||||
# Lifecylce Hook: onModeExit
|
||||
|
||||
If an extension defines the `onModeExit` lifecycle hook, it is called when navigating
|
||||
away from a mode. This hook can be used to clean up data tasks such as unregistering services,
|
||||
removing annotations that do not need to be persisted.
|
||||
|
||||
_Example `onModeExit` hook implementation_
|
||||
|
||||
```js
|
||||
export default {
|
||||
id: 'myExampleExtension',
|
||||
|
||||
onModeExit({ servicesManager, commandsManager}) {
|
||||
myCacheServie.purge()
|
||||
},
|
||||
};
|
||||
```
|
||||
@@ -13,9 +13,30 @@ The `preRegistration` hook receives an object containing the
|
||||
`ExtensionManager`'s associated `ServicesManager`, `CommandsManager`, and any
|
||||
`configuration` that was provided with the extension at time of registration.
|
||||
|
||||
_Example `preRegistration` hook implementation_
|
||||
Example `preRegistration` implementation that register a new service and make it
|
||||
available in the app. We will talk more in details for creating a new service for
|
||||
`OHIF-v3`.
|
||||
|
||||
```js
|
||||
|
||||
// new service inside new extension
|
||||
import MyNewService from './MyNewService';
|
||||
|
||||
export default function MyNewServiceWithServices(serviceManager) {
|
||||
return {
|
||||
name: 'MyNewService',
|
||||
create: ({ configuration = {} }) => {
|
||||
return new MyNewService(serviceManager);
|
||||
},
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
and
|
||||
|
||||
```js
|
||||
import MyNewService from './MyNewService'
|
||||
|
||||
export default {
|
||||
id: 'MyExampleExtension',
|
||||
|
||||
@@ -35,6 +56,10 @@ export default {
|
||||
|
||||
console.log('Important stuff has been wired.');
|
||||
window.importantStuff();
|
||||
|
||||
// Registering new services
|
||||
servicesManager.registerService(MyNewService(servicesManager));
|
||||
},
|
||||
},
|
||||
};
|
||||
```
|
||||
Reference in new issue
Block a user