-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.d.ts
33 lines (30 loc) · 1.38 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
// typescript
declare type Listener = (...args: any[]) => void;
declare type Callback = () => void;
/**
* In the debouncing technique, no matter how many times the user fires the
* event, the attached function will be executed only after the specified
* time once the user stops firing the event.
*
* Returns a function, that, as long as it continues to be invoked, will not
* be triggered. The function will be called after it stops being called for
* N milliseconds.
* @param {!Function} func The function to execute.
* @param {number=} timeout The timeout in milliseconds.
* @return {!Function} Returns a function, that, as long as it continues
* to be invoked, will not be triggered.
*/
export declare function debounce(func: Callback, timeout?: number): Listener;
/**
* Throttling is a technique in which, no matter how many times the user
* fires the event, the attached function will be executed only once in a
* given time interval.
*
* Returns a function, that, as long as it continues to be invoked, will only
* trigger every N milliseconds.
* @param {!Function} func The function to execute.
* @param {number=} timeout The timeout in milliseconds.
* @return {!Function} Returns a function, that, as long as it continues
* to be invoked, will only trigger every N milliseconds.
*/
export declare function throttle(func: Callback, timeout?: number): Listener;