import type { UmbContextToken } from '../token/context-token.js'; import type { UmbContextMinimal } from '../types.js'; import type { UmbContextCallback } from './context-request.event.js'; type HostElementMethod = () => Element; export type UmbContextConsumerAsPromiseOptionsType = { preventTimeout?: boolean; }; /** * @class UmbContextConsumer * @description The context consumer class, used to consume a context from a host element. * Notice it is not recommended to use this class directly, but rather use the `consumeContext` method from a `UmbElement` or `UmbElementMixin` or `UmbControllerBase` or `UmbClassMixin`. * Alternatively, you can use the `UmbContextConsumerController` to consume a context from a host element. But this does require that you can implement one of the Class Mixins mentioned above. */ export declare class UmbContextConsumer { #private; protected _retrieveHost: HostElementMethod; get instance(): ResultType | undefined; /** * Creates an instance of UmbContextConsumer. * @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(host: Element | HostElementMethod, contextIdentifier: string | UmbContextToken, callback?: UmbContextCallback); getHostElement(): Element; /** * @public * @memberof UmbContextConsumer * @description Make the consumption skip the contexts provided by the Host element. * @returns {UmbContextConsumer} - The current instance of the UmbContextConsumer. */ skipHost(): this; /** * @public * @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} - The current instance of the UmbContextConsumer. */ passContextAliasMatches(): this; protected _onResponse: (instance: BaseType) => boolean; protected setInstance(instance: ResultType): Promise; /** * @public * @memberof UmbContextConsumer * @param {UmbContextConsumerAsPromiseOptionsType} options - Prevent the promise from timing out. * @description Get the context as a promise. * @returns {UmbContextConsumer} - A promise that resolves when the context is consumed. */ asPromise(options?: UmbContextConsumerAsPromiseOptionsType): Promise; /** * @public * @memberof UmbContextConsumer * @description Request the context from the host element. */ request(): void; hostConnected(): void; hostDisconnected(): void; destroy(): void; } export {};