Commits

lotte authored 1ab53e72043
added more documentation and cleaned everything up a bit
No tags

src/app/+search-page/search-filters/search-filter/search-filter-type-decorator.ts

Modified
1 1
2 2 import { FilterType } from '../../search-service/filter-type.model';
3 3
4 +/**
5 + * Contains the mapping between a facet component and a FilterType
6 + */
4 7 const filterTypeMap = new Map();
5 8
6 9 /**
7 - * Sets the mapping for a component in relation to a filter type
10 + * Sets the mapping for a facet component in relation to a filter type
8 11 * @param {FilterType} type The type for which the matching component is mapped
9 - * @returns Decorator function that performs the actual mapping on initialization of the component
12 + * @returns Decorator function that performs the actual mapping on initialization of the facet component
10 13 */
11 14 export function renderFacetFor(type: FilterType) {
12 15 return function decorator(objectElement: any) {
13 16 if (!objectElement) {
14 17 return;
15 18 }
16 19 filterTypeMap.set(type, objectElement);
17 20 };
18 21 }
19 22
20 23 /**
21 - * Requests the matching component based on a given filter type
22 - * @param {FilterType} type The filter type for which the component is requested
23 - * @returns The component's constructor that matches the given filter type
24 + * Requests the matching facet component based on a given filter type
25 + * @param {FilterType} type The filter type for which the facet component is requested
26 + * @returns The facet component's constructor that matches the given filter type
24 27 */
25 28 export function renderFilterType(type: FilterType) {
26 29 return filterTypeMap.get(type);
27 30 }

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut