Skip to content

CorePlugin

ts
class CorePlugin {
  /**
     * Observe attribute changes on the grid element
     * @param attrName - The attribute name to observe (supports both kebab-case and camelCase)
     * @param callback - Callback function when attribute changes
     *
     * Note:
     * This observer tracks DOM attribute mutations only (e.g. setAttribute).
     * It does not react to direct property assignments like grid.someProp = value.
     */
  observeAttribute(attrName: string, callback: (value: string | null) => void);

  /**
     * Stop observing an attribute
     * @param attrName - The attribute name to stop observing
     */
  unobserveAttribute(attrName: string);

  observeProperty<T = unknown>(
    propName: string,
    callback: (value: T) => void,
  );

  unobserveProperty(propName: string);

  /**
     * Set the trimmed state for a column
     */
  setColumnTrimmed(trimmed: Record<string, Record<string, boolean | undefined>>, type: DimensionCols);

  /**
     * Destroy plugin and clean up all observers
     */
  destroy();
}