From 87f2881a8f4dd9c8db3366fb58b11bee2e8219b3 Mon Sep 17 00:00:00 2001 From: Jacob Overgaard <752371+iOvergaard@users.noreply.github.com> Date: Tue, 17 Jan 2023 10:00:22 +0100 Subject: [PATCH] add ContextToken --- .../src/core/context-api/context-token.ts | 19 +++++++++++++++++++ .../src/core/context-api/index.ts | 1 + 2 files changed, 20 insertions(+) create mode 100644 src/Umbraco.Web.UI.Client/src/core/context-api/context-token.ts diff --git a/src/Umbraco.Web.UI.Client/src/core/context-api/context-token.ts b/src/Umbraco.Web.UI.Client/src/core/context-api/context-token.ts new file mode 100644 index 0000000000..5f3086d211 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/core/context-api/context-token.ts @@ -0,0 +1,19 @@ +export class ContextToken { + /** + * @param _desc Description for the token, + * used only for debugging purposes, + * it should but does not need to be unique + */ + constructor(protected _desc: string) {} + + /** + * @internal + */ + get multi(): ContextToken> { + return this as ContextToken>; + } + + toString(): string { + return `${ContextToken.name} ${this._desc}`; + } +} diff --git a/src/Umbraco.Web.UI.Client/src/core/context-api/index.ts b/src/Umbraco.Web.UI.Client/src/core/context-api/index.ts index c9bc27c68a..4cb2fa0b29 100644 --- a/src/Umbraco.Web.UI.Client/src/core/context-api/index.ts +++ b/src/Umbraco.Web.UI.Client/src/core/context-api/index.ts @@ -2,3 +2,4 @@ export * from './consume/context-consumer'; export * from './consume/context-request.event'; export * from './provide/context-provider'; export * from './provide/context-provide.event'; +export * from './context-token';