@types/throttle-debounce
Advanced tools
Comparing version 4.0.0 to 5.0.0
@@ -1,2 +0,2 @@ | ||
// Type definitions for throttle-debounce 4.0 | ||
// Type definitions for throttle-debounce 5.0 | ||
// Project: https://github.com/niksy/throttle-debounce | ||
@@ -8,4 +8,8 @@ // Definitions by: Marek Buchar <https://github.com/czbuchi>, Frank Li <https://github.com/franklixuefei>, Thomas Oddsund <https://github.com/oddsund>, Seiya <https://github.com/seiyab> | ||
interface CancelOptions { | ||
upcomingOnly?: boolean; | ||
} | ||
interface Cancel { | ||
cancel: () => void; | ||
cancel: (options?: CancelOptions) => void; | ||
} | ||
@@ -18,3 +22,3 @@ | ||
export type throttle<T extends (...args: any[]) => any> = NoReturn<T> & Cancel; | ||
export type debounce<T extends (...args: any[]) => any> = throttle<T>; | ||
export type debounce<T extends (...args: any[]) => any> = NoReturn<T> & Cancel; | ||
@@ -27,2 +31,6 @@ interface ThrottleOptions { | ||
interface DebounceOptions { | ||
atBegin?: boolean; | ||
} | ||
/** | ||
@@ -79,9 +87,2 @@ * Throttle execution of a function. Especially useful for rate limiting | ||
* | ||
* @param atBegin | ||
* If atBegin is false or unspecified, callback will only be executed `delay` | ||
* milliseconds after the last debounced-function call. If atBegin is true, | ||
* callback will be executed only at the first debounced-function call. (After | ||
* the throttled-function has not been called for `delay` milliseconds, the | ||
* internal counter is reset). | ||
* | ||
* @param callback | ||
@@ -92,24 +93,19 @@ * A function to be executed after delay milliseconds. The `this` context and | ||
* | ||
* @return | ||
* A new, debounced function. | ||
*/ | ||
export function debounce<T extends (...args: any[]) => any>(delay: number, atBegin: boolean, callback: T): debounce<T>; | ||
/** | ||
* Debounce execution of a function. Debouncing, unlike throttling, | ||
* guarantees that a function is only executed a single time, either at the | ||
* very beginning of a series of calls, or at the very end. | ||
* @param options | ||
* An object to configure options. | ||
* | ||
* @param delay | ||
* A zero-or-greater delay in milliseconds. For event callbacks, values around | ||
* 100 or 250 (or even higher) are most useful. | ||
* @param options.atBegin | ||
* If atBegin is false or unspecified, callback will only be executed `delay` | ||
* milliseconds after the last debounced-function call. If atBegin is true, | ||
* callback will be executed only at the first debounced-function call. (After | ||
* the throttled-function has not been called for `delay` milliseconds, the | ||
* internal counter is reset). | ||
* | ||
* @param callback | ||
* A function to be executed after delay milliseconds. The `this` context and | ||
* all arguments are passed through, as-is, to `callback` when the | ||
* debounced-function is executed. | ||
* | ||
* @return | ||
* A new, debounced function. | ||
*/ | ||
export function debounce<T extends (...args: any[]) => any>(delay: number, callback: T): debounce<T>; | ||
export function debounce<T extends (...args: any[]) => any>( | ||
delay: number, | ||
callback: T, | ||
options?: DebounceOptions, | ||
): debounce<T>; |
{ | ||
"name": "@types/throttle-debounce", | ||
"version": "4.0.0", | ||
"version": "5.0.0", | ||
"description": "TypeScript definitions for throttle-debounce", | ||
@@ -38,4 +38,4 @@ "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/throttle-debounce", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "6553922707bbe2109ba27cf9e79336f8fcf85ca6cacfbd468c52ee58a5b92343", | ||
"typesPublisherContentHash": "87f1bb728efa277e6c3acae32e40aae3044792774474f0d7cc04528ea7f171d0", | ||
"typeScriptVersion": "3.9" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Mon, 11 Apr 2022 19:01:24 GMT | ||
* Last updated: Wed, 04 May 2022 01:01:37 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: none |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
6858
97