This commit is contained in:
Niels Lyngsø
2024-08-19 13:24:34 +02:00
parent 0fcaa795c4
commit fa2efa919d
3 changed files with 16 additions and 18 deletions

View File

@@ -11,10 +11,10 @@ import type { Observable } from '@umbraco-cms/backoffice/external/rxjs';
export interface UmbClassInterface extends UmbControllerHost {
/**
* @description Observe an Observable. An Observable is a declared source of data that can be observed. An observables is declared from a UmbState.
* @param {Observable<T>} source An Observable to observe from.
* @param {method} callback Callback method called when data is changed.
* @param {Observable} source An Observable to observe from.
* @param {ObserverCallback} callback Callback method called when data is changed.
* @returns {UmbObserverController} Reference to the created Observer Controller instance.
* @memberof UmbClassMixin
* @memberof UmbClassInterface
*/
observe<
ObservableType extends Observable<T> | undefined,
@@ -36,19 +36,19 @@ export interface UmbClassInterface extends UmbControllerHost {
/**
* @description Provide a context API for this or child elements.
* @param {string} contextAlias
* @param {string} alias
* @param {instance} instance The API instance to be exposed.
* @returns {UmbContextProviderController} Reference to the created Context Provider Controller instance
* @memberof UmbClassMixin
* @memberof UmbClassInterface
*/
provideContext<R = unknown>(alias: string | UmbContextToken<R>, instance: R): UmbContextProviderController<R>;
/**
* @description Setup a subscription for a context. The callback is called when the context is resolved.
* @param {string} contextAlias
* @param {method} callback Callback method called when context is resolved.
* @param {string} alias
* @param {ObserverCallback} callback Callback method called when context is resolved.
* @returns {UmbContextConsumerController} Reference to the created Context Consumer Controller instance
* @memberof UmbClassMixin
* @memberof UmbClassInterface
*/
consumeContext<BaseType = unknown, ResultType extends BaseType = BaseType>(
alias: string | UmbContextToken<BaseType, ResultType>,
@@ -57,9 +57,9 @@ export interface UmbClassInterface extends UmbControllerHost {
/**
* @description Retrieve a context. Notice this is a one time retrieving of a context, meaning if you expect this to be up to date with reality you should instead use the consumeContext method.
* @param {string} contextAlias
* @param {string} alias
* @returns {Promise<ContextType>} A Promise with the reference to the Context Api Instance
* @memberof UmbClassMixin
* @memberof UmbClassInterface
*/
getContext<BaseType = unknown, ResultType extends BaseType = BaseType>(
alias: string | UmbContextToken<BaseType, ResultType>,

View File

@@ -27,9 +27,9 @@ export class UmbContextConsumer<BaseType = unknown, ResultType extends BaseType
/**
* Creates an instance of UmbContextConsumer.
* @param {Element} host
* @param {string} contextIdentifier
* @param {UmbContextCallback} callback
* @param {Element} host - The host element.
* @param {string} contextIdentifier - The context identifier, an alias or a Context Token.
* @param {UmbContextCallback} callback - The callback.
* @memberof UmbContextConsumer
*/
constructor(
@@ -49,7 +49,7 @@ export class UmbContextConsumer<BaseType = unknown, ResultType extends BaseType
* @public
* @memberof UmbContextConsumer
* @description Make the consumption skip the contexts provided by the Host element.
* @returns {UmbContextConsumer}
* @returns {UmbContextConsumer} - The current instance of the UmbContextConsumer.
*/
public skipHost() {
this.#skipHost = true;
@@ -61,7 +61,7 @@ export class UmbContextConsumer<BaseType = unknown, ResultType extends BaseType
* @memberof UmbContextConsumer
* @description Pass beyond any context aliases that matches this.
* The default behavior is to stop at first Context Alias match, this is to avoid receiving unforeseen descending contexts.
* @returns {UmbContextConsumer}
* @returns {UmbContextConsumer} - The current instance of the UmbContextConsumer.
*/
public passContextAliasMatches() {
this.#stopAtContextMatch = false;
@@ -99,7 +99,7 @@ export class UmbContextConsumer<BaseType = unknown, ResultType extends BaseType
* @public
* @memberof UmbContextConsumer
* @description Get the context as a promise.
* @returns {UmbContextConsumer}
* @returns {UmbContextConsumer} - A promise that resolves when the context is consumed.
*/
public asPromise(): Promise<ResultType> {
return (

View File

@@ -4,7 +4,6 @@ export const UMB_DEBUG_CONTEXT_EVENT_TYPE = 'umb:debug-contexts';
export type UmbContextCallback<T> = (instance: T) => void;
/**
* @interface UmbContextRequestEvent
*/
export interface UmbContextRequestEvent<ResultType = unknown> extends Event {
@@ -16,7 +15,6 @@ export interface UmbContextRequestEvent<ResultType = unknown> extends Event {
}
/**
* @class UmbContextRequestEventImplementation
* @augments {Event}
* @implements {UmbContextRequestEvent}