Files
Umbraco-CMS/src/Umbraco.Web.UI.Client/storybook/stories/umb-controller.mdx
Niels Lyngsø ad282e6eb7 Context API discriminator (#839)
* ability to set discriminator method

* test context discriminator

* clean up

* Embed the discriminator method in ContextToken

* main type dance, still 6 minor things to correct.

* temp commit, before test removing DicriminatorType

* one less generic type to parse around

* implement UMB_DATA_TYPE_WORKSPACE_CONTEXT

* user workspace context token

* stylesheet

* media

* member

* document

* language

* template

* media-type

* user group

* dictionary

* member type

* member group

* correct member group token

* relation type

* partial views

* document-type

* remove unused prop

* remove console.log

* docs

* import order

* variable name update

* correct text

* added implementation example

---------

Co-authored-by: Mads Rasmussen <madsr@hey.com>
2023-09-05 10:27:00 +02:00

21 lines
935 B
Plaintext

import { Meta } from '@storybook/addon-docs';
<Meta title="Guides/Umbraco Controller" parameters={{ previewTabs: { canvas: { hidden: true } } }} />
# Umbraco Controller
This class can be used as the base of any class.
This will enable Controllers to be hosted in this class. Additionally it provides few shortcut methods for initializing core Umbraco Controllers.
```ts
observe<T>(source: Observable<T>, callback: (_value: T) => void, unique?: string): UmbObserverController<T>
provideContext<R = unknown>(alias: string | UmbContextToken<R>, instance: R): UmbContextProviderController<R>
consumeContext<R = unknown>(alias: string | UmbContextToken<R>, callback: UmbContextCallback<R>): UmbContextConsumerController<R>
```
Read about the 'observe' method in the [Store-API](?path=/docs/guides-store--docs).
Read about the 'provideContext' and 'consumeContext' methods in the [Context-API](?path=/docs/guides-context-api--docs).