@esri/calcite-components
Version:
Web Components for Esri's Calcite Design System.
42 lines (41 loc) • 1.07 kB
TypeScript
type AttributeObject = {
[k: string]: any;
};
type AllowedGlobalAttribute = "lang" | "role";
/**
* Watches global attributes of a component.
*
* Derived from: https://gist.github.com/willmartian/b4dd6b57d71dd0438fb9e7c6f4048578
*/
export interface GlobalAttrComponent {
/**
* The host element.
*/
readonly el: HTMLElement;
/**
* The object that stores global attributes to apply internally during rendering.
*
* This prop should use the `@State` decorator.
*/
globalAttributes: AttributeObject;
}
/**
* Helper to set up listening for changes to global attributes.
*
* render(): VNode {
* return (<Host>
* <ul {...this.globalAttributes}></div>
* </Host>);
* }
*
* @param component
* @param attributeFilter
*/
export declare function watchGlobalAttributes(component: GlobalAttrComponent, attributeFilter: AllowedGlobalAttribute[]): void;
/**
* Helper remove listening for changes to inherited attributes.
*
* @param component
*/
export declare function unwatchGlobalAttributes(component: GlobalAttrComponent): void;
export {};