/**
* Get all the components of the given name.
*/
- public get(name: string): Component[] {
- return this.components[name] || [];
+ public get<T extends Component>(name: string): T[] {
+ return (this.components[name] || []) as T[];
}
/**
const elComponents = this.elementComponentMap.get(element) || {};
return elComponents[name] || null;
}
+
+ public allWithinElement<T extends Component>(element: HTMLElement, name: string): T[] {
+ const components = this.get<T>(name);
+ return components.filter(c => element.contains(c.$el));
+ }
}