Configuration object containing context, callback, and subscribe options
A property decorator function
import {consumeContext} from '@umbraco-cms/backoffice/context-api';
import {UMB_WORKSPACE_CONTEXT} from './workspace.context-token.js';
class MyElement extends UmbLitElement {
// Standard decorators (with 'accessor' keyword) - Modern approach
@consumeContext({context: UMB_WORKSPACE_CONTEXT})
accessor workspaceContext?: UmbWorkspaceContext;
// Legacy decorators (without 'accessor') - Works with @state/@property
@consumeContext({context: UMB_USER_CONTEXT, subscribe: false})
@state()
currentUser?: UmbUserContext;
}
A property decorator that adds an UmbContextConsumerController to the component which will try and retrieve a value for the property via the Umbraco Context API.
This decorator supports both modern "standard" decorators (Stage 3 TC39 proposal) and legacy TypeScript experimental decorators for backward compatibility.