UNPKG

@reaktly-js/tone-accessibility

Version:

A vanilla JS Accessability Widget compliant with ADA and WCAG 2.2.

30 lines (29 loc) 1.36 kB
/** * @interface ToneWebComponentLifecycle * @description Defines the expected lifecycle methods for Tone widget's custom elements. * This interface primarily serves as a clear contract and documentation, * complementing the native HTMLElement lifecycle. */ export interface ToneWebComponentLifecycle { /** * Invoked when the custom element is first connected to the document's DOM. * This is the place to perform setup like adding event listeners, initializing state, * or performing initial rendering. */ connectedCallback(): void; /** * Invoked when the custom element is disconnected from the document's DOM. * This is the place to perform cleanup like removing event listeners or observers * to prevent memory leaks. */ disconnectedCallback(): void; /** * Invoked when one of the custom element's observed attributes is added, removed, * or changed. This is crucial for reacting to external configuration changes * like `lang` or `fab-position`. * @param name The name of the attribute that changed. * @param oldValue The attribute's old value, or null if it was just added. * @param newValue The attribute's new value, or null if it was just removed. */ attributeChangedCallback?(name: string, oldValue: string | null, newValue: string | null): void; }