declare global {
interface HTMLElement {
hoodDataList: DataList;
}
}
export interface DataListOptions {
/**
* Called before the data is fetched.
*/
onLoad?: (sender?: HTMLElement) => void;
/**
* Called before the fetched HTML is rendered to the list. Must return the data back to datalist to render.
*/
onRender?: (html: string, sender?: HTMLElement) => string;
/**
* Called when loading and rendering is complete.
*/
onComplete?: (html: string, sender?: HTMLElement) => void;
/**
* Called when an error occurs.
*/
onError?: (jqXHR: any, textStatus: any, errorThrown: any) => void;
}
/**
* Attach a data list feed to an HTML element. The element must have a data-url attribute to connect to a feed.
*/
export declare class DataList {
element: HTMLElement;
options: DataListOptions;
/**
* @param element The datalist element. The element must have a data-url attribute to connect to a feed.
*/
constructor(element: HTMLElement, options: DataListOptions);
reload(this: DataList, url?: URL): void;
}