Skip to content

Commit baef2df

Browse files
committed
add namable workspace context token + interface
1 parent 3b8ec46 commit baef2df

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export * from './namable-workspace-context.interface.js';
2+
export * from './namable-workspace.context-token.js';
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { UmbWorkspaceContext } from '../workspace-context.interface.js';
2+
import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
3+
4+
export interface UmbNamableWorkspaceContext extends UmbWorkspaceContext {
5+
name: Observable<string | undefined>;
6+
getName(): string | undefined;
7+
setName(name: string): void;
8+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
import type { UmbWorkspaceContext } from '../workspace-context.interface.js';
2+
import type { UmbNamableWorkspaceContext } from './namable-workspace-context.interface.js';
3+
import { UmbContextToken } from '@umbraco-cms/backoffice/context-api';
4+
5+
export const UMB_NAMABLE_WORKSPACE_CONTEXT = new UmbContextToken<UmbWorkspaceContext, UmbNamableWorkspaceContext>(
6+
'UmbWorkspaceContext',
7+
undefined,
8+
(context): context is UmbNamableWorkspaceContext => (context as any).getName !== undefined,
9+
);

0 commit comments

Comments
 (0)