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';