diff --git a/src/Umbraco.Web.UI.Client/src/core/context-api/consume/context-consumer.ts b/src/Umbraco.Web.UI.Client/src/core/context-api/consume/context-consumer.ts index 45ace142f1..e8c3cb8919 100644 --- a/src/Umbraco.Web.UI.Client/src/core/context-api/consume/context-consumer.ts +++ b/src/Umbraco.Web.UI.Client/src/core/context-api/consume/context-consumer.ts @@ -6,6 +6,11 @@ import { UmbContextRequestEventImplementation, UmbContextCallback } from './cont * @class UmbContextConsumer */ export class UmbContextConsumer { + + get consumerAlias() { + return this._contextAlias; + } + /** * Creates an instance of UmbContextConsumer. * @param {EventTarget} target diff --git a/src/Umbraco.Web.UI.Client/src/core/context-api/consume/is-context-consumer-type.function.ts b/src/Umbraco.Web.UI.Client/src/core/context-api/consume/is-context-consumer-type.function.ts new file mode 100644 index 0000000000..f6339ee4f6 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/context-api/consume/is-context-consumer-type.function.ts @@ -0,0 +1,7 @@ +import { UmbContextConsumer } from './context-consumer'; + +export function isContextConsumerType(instance: unknown): instance is UmbContextConsumer { + return ( + typeof instance === 'object' && instance !== null && (instance as UmbContextConsumer).consumerAlias !== undefined + ); +}