From b0220fbb2305130c6772d9a9ebac7903a0080573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Lyngs=C3=B8?= Date: Mon, 2 Jan 2023 16:11:05 +0100 Subject: [PATCH] getControllers --- .../src/core/controller/controller-host.mixin.ts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Umbraco.Web.UI.Client/src/core/controller/controller-host.mixin.ts b/src/Umbraco.Web.UI.Client/src/core/controller/controller-host.mixin.ts index a81fc086ea..f7af1c7529 100644 --- a/src/Umbraco.Web.UI.Client/src/core/controller/controller-host.mixin.ts +++ b/src/Umbraco.Web.UI.Client/src/core/controller/controller-host.mixin.ts @@ -5,6 +5,7 @@ export declare class UmbControllerHostInterface extends HTMLElement { //#controllers:UmbController[]; //#attached:boolean; hasController(controller:UmbControllerInterface): boolean; + getControllers(filterMethod: (ctrl: UmbControllerInterface) => boolean): UmbControllerInterface[]; addController(controller:UmbControllerInterface): void; removeController(controller:UmbControllerInterface): void; } @@ -31,6 +32,14 @@ export const UmbControllerHostMixin = (superCl return (this.#controllers.indexOf(ctrl) !== -1); } + /** + * Retrieve controllers matching a filter of this element. + * @param {method} filterMethod + */ + getControllers(filterMethod: (ctrl: UmbControllerInterface) => boolean): UmbControllerInterface[] { + return this.#controllers.filter(filterMethod); + } + /** * Append a controller to this element. * @param {UmbControllerInterface} ctrl