/** * Protects a function which is to be used as a handler by preventing its * execution for the duration of a previous call to it (including async * parts of that call). * * @param {function} fct * The function which is to be used as a handler. If a promise * is returned, it is used to determine when the handler's action is * finished. Otherwise, the return is used as jQuery uses it. */ export function makeAsyncHandler(fct: Function): (...args: any[]) => any; /** * Creates a debounced version of a function to be used as a button click * handler. Also improves the handler to disable the button for the time of * the debounce and/or the time of the async actions it performs. * * Limitation: if two handlers are put on the same button, the button will * become enabled again once any handler's action finishes (multiple click * handlers should however not be bound to the same button). * * @param {function} fct * The function which is to be used as a button click handler. If a * promise is returned, it is used to determine when the button can be * re-enabled. Otherwise, the return is used as jQuery uses it. */ export function makeButtonHandler(fct: Function): (ev: any, ...args: any[]) => any; /** * Patches a "t-" entry of a dynamic content. * * @param {Object} dynamicContent * @param {string} selector * @param {string} t * @param {any|function} replacement, if a function, takes the element and the * replaced's function output as parameters */ export function patchDynamicContentEntry(dynamicContent: Object, selector: string, t: string, replacement: any | Function): void; /** * Patches several entries in a dynamicContent. * Example usage: * patchDynamicContent(this.dynamicContent, { * _root: { * "t-att-class": (el, old) => ({ * "test": this.condition && old.test, * }), * "t-on-click": (el, oldFn) => { * oldFn(el); * this.doMoreStuff(); * }, * }, * }) * * @param {Object} dynamicContent * @param {Object} replacement */ export function patchDynamicContent(dynamicContent: Object, replacement: Object): void; export class PairSet { map: Map; add(elem1: any, elem2: any): void; has(elem1: any, elem2: any): any; delete(elem1: any, elem2: any): void; } export const DEBOUNCE: 400; export const BUTTON_HANDLER_SELECTOR: "a, button, input[type=\"submit\"], input[type=\"button\"], .btn";