add some jsdoc

This commit is contained in:
Vendicated
2023-04-10 01:16:44 +02:00
parent c2eaa9d35a
commit edfeca15ce
5 changed files with 61 additions and 5 deletions

View File

@@ -4,6 +4,12 @@
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
/**
* Returns a new function that will only be called after the given delay.
* Subsequent calls will cancel the previous timeout and start a new one from 0
*
* Useful for grouping multiple calls into one
*/
export function debounce<T extends Function>(func: T, delay = 300): T {
let timeout: NodeJS.Timeout;
return function (...args: any[]) {