fix merge gone bad

This commit is contained in:
Mads Rasmussen
2023-03-01 16:50:07 +01:00
parent 2488c21d10
commit becf92be93
2 changed files with 3 additions and 42 deletions

View File

@@ -10,7 +10,7 @@ The Element implements the Controller Host and provides a few shortcut methods f
The methods are (_note this can be out of date, we need to look into how we can ensure this Doc originates from code._)
```
```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>
@@ -20,7 +20,7 @@ consumeContext<R = unknown>(alias: string | UmbContextToken<R>, callback: UmbCon
Use these for an smooth consumption, like this request for a Context API using a simple string context, where the callback value is unknown
```
```ts
this.consumeContext('requestThisContextAlias', (context) => {
// Notice this is a subscription, as context might change or a new one appears.
console.log("I've got the context", context);
@@ -29,7 +29,7 @@ this.consumeContext('requestThisContextAlias', (context) => {
Or use the UmbContextToken type to define the type of the context, like this
```
```ts
const contextAlias = new UmbContextToken<SomeType>('description of context for debugging purposes');
this.consumeContext(contextAlias, (context) => {

View File

@@ -1,39 +0,0 @@
import { Meta } from '@storybook/addon-docs';
<Meta title="Guides/Umbraco Element" parameters={{ previewTabs: { canvas: { hidden: true } } }} />
# Umbraco Element
This element can be used as the base of any Element.
Do this if you need to Observe Data, Consume or Provide a Context API or use a Resource.
The Element implements the Controller Host and provides a few shortcut methods for initializing some Controllers.
The methods are (_note this can be out of date, we need to look into how we can ensure this Doc originates from code._)
```typescript
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>
```
Use these for an smooth consumption, like this request for a Context API using a simple string context, where the callback value is unknown
```typescript
this.consumeContext('requestThisContextAlias', (context) => {
// Notice this is a subscription, as context might change or a new one appears.
console.log("I've got the context", context);
});
```
Or use the UmbContextToken type to define the type of the context, like this
```typescript
const contextAlias = new UmbContextToken<SomeType>('description of context for debugging purposes');
this.consumeContext(contextAlias, (context) => {
// Notice this is a subscription, as context might change or a new one appears, but the value is strongly typed
console.log("I've got the context", context);
});
```