mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
Merge pull request #30969 from wcarson/debounce
Added flush() method to debounce package (see https://git.io/fpoYM)
This commit is contained in:
commit
ead110d5f4
@ -14,6 +14,9 @@ const imm1: number = (debounce((x: number) => x * 2, 100, true))(2);
|
||||
const clearable = debounce(doThings);
|
||||
clearable.clear();
|
||||
|
||||
const flushable = debounce(doThings);
|
||||
flushable.flush();
|
||||
|
||||
// Intentionally asserts that the member variable has all the same benefits as the direct export.
|
||||
// Eventually, if debounce stop supporting the CommonJS-only module calling (`require("debounce")(...)`),
|
||||
// we can remove this and change the top import&require to `import { debounce } from "debounce";`.
|
||||
|
||||
6
types/debounce/index.d.ts
vendored
6
types/debounce/index.d.ts
vendored
@ -1,13 +1,15 @@
|
||||
// Type definitions for debounce 3.0
|
||||
// Type definitions for debounce 1.2
|
||||
// Project: https://github.com/component/debounce
|
||||
// Definitions by: Denis Sokolov <https://github.com/denis-sokolov>
|
||||
// Josh Goldberg <https://github.com/joshuakgoldberg>
|
||||
// Wayne Carson <https://github.com/wcarson>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
declare namespace _debounce {
|
||||
const debounce: typeof _debounce;
|
||||
}
|
||||
|
||||
declare function _debounce<A extends Function>(f: A, interval?: number, immediate?: boolean): A & { clear(): void; };
|
||||
declare function _debounce<A extends Function>(f: A, interval?: number, immediate?: boolean): A & { clear(): void; }
|
||||
& { flush(): void };
|
||||
|
||||
export = _debounce;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user