mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-10 11:33:04 +00:00
added type doc to menu related files
This commit is contained in:
26
src/app/shared/menu/menu-item.decorator.ts
Normal file
26
src/app/shared/menu/menu-item.decorator.ts
Normal file
@@ -0,0 +1,26 @@
|
||||
import { MenuItemType } from './initial-menus-state';
|
||||
|
||||
const menuMenuItemComponentMap = new Map();
|
||||
|
||||
/**
|
||||
* Decorator function to link a MenuItemType to a Component
|
||||
* @param {MenuItemType} type The MenuItemType of the MenuSection's model
|
||||
* @returns {(sectionComponent: GenericContructor) => void}
|
||||
*/
|
||||
export function rendersMenuItemForType(type: MenuItemType) {
|
||||
return function decorator(sectionComponent: any) {
|
||||
if (!sectionComponent) {
|
||||
return;
|
||||
}
|
||||
menuMenuItemComponentMap.set(type, sectionComponent);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the Component matching a given MenuItemType
|
||||
* @param {MenuItemType} type The given MenuItemType
|
||||
* @returns {GenericConstructor} The constructor of the Component that matches the MenuItemType
|
||||
*/
|
||||
export function getComponentForMenuItemType(type: MenuItemType) {
|
||||
return menuMenuItemComponentMap.get(type);
|
||||
}
|
Reference in New Issue
Block a user