Skip to content

Commit d9637c0

Browse files
committed
docs: update docstrings to include more information
1 parent 0dd7e06 commit d9637c0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/core/src/shared/utilities/functionUtils.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,10 @@ export function memoize<T, U extends any[]>(fn: (...args: U) => T): (...args: U)
8585
* Multiple calls made during the debounce window will receive references to the
8686
* same Promise similar to {@link shared}. The window will also be 'rolled', delaying
8787
* the execution by another {@link delay} milliseconds.
88+
*
89+
* This function prevents execution until {@link delay} milliseconds have passed
90+
* since the last invocation regardless of arguments. If this should be
91+
* argument dependent, look into {@link keyedDebounce}
8892
*/
8993
export function debounce<Input extends any[], Output>(
9094
cb: (...args: Input) => Output | Promise<Output>,
@@ -95,7 +99,7 @@ export function debounce<Input extends any[], Output>(
9599

96100
/**
97101
*
98-
* Similar to {@link debounce}, but allows the function to be cancelled and allow callbacks to pass function parameters.
102+
* Similar to {@link debounce}, but allows the function to be cancelled.
99103
*/
100104
export function cancellableDebounce<Input extends any[], Output>(
101105
cb: (...args: Input) => Output | Promise<Output>,
@@ -132,6 +136,10 @@ export function cancellableDebounce<Input extends any[], Output>(
132136
}
133137
}
134138

139+
/**
140+
*
141+
* Similar to {@link debounce}, but uses a key to determine if the function should be called yet rather than a timeout connected to the function itself.
142+
*/
135143
export function keyedDebounce<T, U extends any[], K extends string = string>(
136144
fn: (key: K, ...args: U) => Promise<T>
137145
): typeof fn {

0 commit comments

Comments
 (0)