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,11 @@
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
/**
* Wraps the given function so that it can only be called once
* @param fn Function to wrap
* @returns New function that can only be called once
*/
export function once<T extends Function>(fn: T): T {
let called = false;
return function (this: any, ...args: any[]) {