Skip to content

Commit 2111324

Browse files
committed
Add typings for throttled and debounce
1 parent 992cdec commit 2111324

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

types/helpers/helpers.extras.d.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,25 @@
1+
import { AnyObject } from '../basic';
2+
13
export function fontString(pixelSize: number, fontStyle: string, fontFamily: string): string;
24

35
/**
46
* Request animation polyfill
57
*/
68
export function requestAnimFrame(cb: () => void): void;
9+
10+
/**
11+
* Throttles calling `fn` once per animation frame
12+
* Latest argments are used on the actual call
13+
* @param {function} fn
14+
* @param {*} thisArg
15+
* @param {function} [updateFn]
16+
*/
17+
export function throttled(fn: () => void, thisArg: AnyObject, updateFn: (AnyObject) => AnyObject): () => void;
18+
19+
/**
20+
* Debounces calling `fn` for `delay` ms
21+
* @param {function} fn - Function to call. No arguments are passed.
22+
* @param {number} delay - Delay in ms. 0 = immediate invocation.
23+
* @returns {function}
24+
*/
25+
export function debounce(fn: () => void, delay: number): () => number;

0 commit comments

Comments
 (0)