@types/element-resize-detector
TypeScript icon, indicating that this package has built-in type declarations

1.1.6 • Public • Published

Installation

npm install --save @types/element-resize-detector

Summary

This package contains type definitions for element-resize-detector (https://github.com/wnr/element-resize-detector).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/element-resize-detector.

index.d.ts

declare function elementResizeDetectorMaker(
    options?: elementResizeDetectorMaker.ErdmOptions,
): elementResizeDetectorMaker.Erd;

declare namespace elementResizeDetectorMaker {
    interface ErdmOptions {
        strategy?: "scroll" | "object" | undefined;
        /**
         * A custom reporter that handles reporting logs, warnings and errors.
         * If not provided, a default id handler will be used.
         * If set to false, then nothing will be reported.
         */
        reporter?: ReporterProps | undefined;

        /**
         * Determines if listeners should be called when they are getting added.
         * If true, the listener is guaranteed to be called when it has been added.
         * If false, the listener will not be guarenteed to be called when
         * it has been added (does not prevent it from being called).
         *
         * @default true
         */
        callOnAdd?: boolean | undefined;

        /**
         * A custom id handler that is responsible for generating,
         * setting and retrieving id's for elements.
         * If not provided, a default id handler will be used.
         */
        idHandler?: IdHandlerProps | undefined;

        /**
         * If set to true, the the system will report debug messages as default
         * for the listenTo method.
         */
        debug?: boolean | undefined;
    }

    interface IdHandlerProps {
        get(element: HTMLElement, readonly: boolean): string;
        set(element: HTMLElement): string;
    }

    interface ReporterProps {
        log(idOrText: string, textOrId: string, element?: HTMLElement): void;
        warn(text: string, element?: HTMLElement): void;
        error(text: string): void;
    }

    interface Erd {
        listenTo(element: HTMLElement, callback: (elem: HTMLElement) => void): void;
        removeListener(element: HTMLElement, callback: (elem: HTMLElement) => void): void;
        removeAllListeners(element: HTMLElement): void;
        uninstall(element: HTMLElement): void;
    }
}

export = elementResizeDetectorMaker;

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: none

Credits

These definitions were written by Saransh Kataria, and Frank Li.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/element-resize-detector

Weekly Downloads

13,712

Version

1.1.6

License

MIT

Unpacked Size

7.04 kB

Total Files

5

Last publish

Collaborators

  • types