Fix element-resize-detector options

This commit is contained in:
Konch Roman
2018-11-16 14:22:42 +03:00
parent e31b168ef1
commit edbb9d5fb0
+42 -5
View File
@@ -7,14 +7,51 @@ declare function elementResizeDetectorMaker(options?: elementResizeDetectorMaker
declare namespace elementResizeDetectorMaker {
interface ErdmOptions {
strategy?: 'scroll' | 'object';
strategy?: 'scroll' | 'object';
/**
* 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;
/**
* If set to true, the the system will report debug messages as default
* for the listenTo method.
*/
debug?: boolean;
/**
* 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?: {
get(element: HTMLElement, readonly: boolean): any;
set(element: HTMLElement): any;
};
/**
* 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?: false | {
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;
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;