UNPKG

@exadel/esl

Version:

Exadel Smart Library (ESL) is the lightweight custom elements library that provide a set of super-flexible components

21 lines (20 loc) 1.03 kB
import type { AnyToAnyFnSignature } from '../misc/functions'; /** Debounced<F> is a function wrapper type for a function decorated via debounce */ export interface Debounced<F extends AnyToAnyFnSignature> { /** Debounced method signature */ (...args: Parameters<F>): void; /** Promise of deferred function call */ promise: Promise<ReturnType<F> | void>; /** Cancel debounced call */ cancel(): void; } /** * Creates a debounced function that implements {@link Debounced}. * Debounced function delays invoking func until after wait milliseconds have elapsed * since the last time the debounced function was invoked. * The func is invoked with the last arguments provided to the debounced function. * @param fn - function to decorate * @param wait - time to debounce * @param thisArg - optional context to call original function, use debounced method call context if not defined */ export declare function debounce<F extends AnyToAnyFnSignature>(fn: F, wait?: number, thisArg?: object): Debounced<F>;