added type doc to menu related files

This commit is contained in:
lotte
2018-12-11 15:47:41 +01:00
parent c0a4fdc797
commit e13d743e32
35 changed files with 765 additions and 231 deletions

View 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);
}