Skip to content

Commit aefe2e8

Browse files
Luuk PetersLuuk Peters
authored andcommitted
Refactor context API documentation for clarity and consistency
1 parent a7845c1 commit aefe2e8

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

16/umbraco-cms/customizing/foundation/context-api/consume-a-context.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,10 @@ This example creates an example service that can show a notification in the back
215215
import { UmbControllerBase } from '@umbraco-cms/backoffice/class-api';
216216
import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification';
217217

218-
//The example element extends the UmbLitElement (which is the same as UmbElementMixin(LitElement))
219-
//This gives us all the helpers we need to get or consume contexts
218+
// This service class extends UmbControllerBase
219+
// This gives us access to getContext() and consumeContext()
220220
export default class ExampleService extends UmbControllerBase {
221-
async ShowNotification(notificationText) {
221+
async showNotification(notificationText) {
222222

223223
//We try to get an instance of the context
224224
const notificationContext = await this.getContext(UMB_NOTIFICATION_CONTEXT);
@@ -253,7 +253,7 @@ export class ExampleService extends UmbControllerBase {
253253
constructor(host) {
254254
super(host);
255255

256-
// Subscribe to the notification context
256+
// Subscribe to the document workspace context
257257
this.consumeContext(UMB_DOCUMENT_WORKSPACE_CONTEXT, (context) => {
258258
if (context) {
259259
console.log("I've got the document workspace context: ", context);

16/umbraco-cms/customizing/foundation/context-api/context-api-fundamentals.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ The Context API exists to solve common problems in complex user interfaces:
2828
To understand the Context API, it's important to understand the terminology that is used in the rest of the documentation.
2929

3030
### Context
31-
An object that encapsulates both data and methods to interact with that data. This object can be provided to descending DOM elements. A context represents a specific capability or state that multiple elements might need to access. Examples include workspace context, content data, user permissions, or specialized services. Contexts encapsulate both data and methods, making them more than simple data containers. Unlike repositories, a context is always only available within the scope of a certain element and it's descendants.
31+
An object that encapsulates both data and methods to interact with that data. This object can be provided to descending DOM elements. A context represents a specific capability or state that multiple elements might need to access. Examples include workspace context, content data, user permissions, or specialized services. Contexts encapsulate both data and methods, making them more than simple data containers. Unlike repositories, a context is always only available within the scope of a certain element and its descendants.
3232

3333
### Context provider
3434
An element that creates and makes a context available to its descending elements. The provider is responsible for the context's lifecycle. One element can provide multiple different contexts if needed.

0 commit comments

Comments
 (0)