@fibercom/routeros-api
Version:
Robust MikroTik RouterOS API client for Node.js and TypeScript
17 lines (16 loc) • 655 B
TypeScript
/**
* Creates a debounced function wrapper that delays the execution
* of the callback until after a specified timeout has elapsed
* since the last invocation.
*
* This is useful in RouterOS streaming cases where frequent updates
* could be throttled to avoid unnecessary processing.
*
* @param callback - The function to debounce
* @param timeout - Delay in milliseconds (default: 0)
* @returns An object with `.run()` to invoke the debounced function and `.cancel()` to clear the timer
*/
export declare const debounce: (callback: (...args: any[]) => void, timeout?: number) => {
run: (...args: any[]) => void;
cancel: () => void;
};