diff options
author | Vendicated <vendicated@riseup.net> | 2022-11-25 19:25:35 +0100 |
---|---|---|
committer | Vendicated <vendicated@riseup.net> | 2022-11-25 19:25:35 +0100 |
commit | a85ec594a77557e5f48c4cf1aa33680e0da94654 (patch) | |
tree | e88fa38f588fef187a0caec884763fc50da8385d /src/utils/misc.tsx | |
parent | c2c6c9fccb3b94340037d2136d647817d0a1c916 (diff) | |
download | Vencord-a85ec594a77557e5f48c4cf1aa33680e0da94654.tar.gz Vencord-a85ec594a77557e5f48c4cf1aa33680e0da94654.tar.bz2 Vencord-a85ec594a77557e5f48c4cf1aa33680e0da94654.zip |
[skip ci] docs docs docs
Diffstat (limited to 'src/utils/misc.tsx')
-rw-r--r-- | src/utils/misc.tsx | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/utils/misc.tsx b/src/utils/misc.tsx index 44fc819..7389cc2 100644 --- a/src/utils/misc.tsx +++ b/src/utils/misc.tsx @@ -70,6 +70,9 @@ export function useAwaiter<T>(factory: () => Promise<T>, fallbackValue: T | null return [state.value, state.error, state.pending, () => setSignal(signal + 1)]; } +/** + * Returns a function that can be used to force rerender react components + */ export function useForceUpdater() { const [, set] = React.useState(0); return () => set(s => s + 1); @@ -144,6 +147,9 @@ export function classes(...classes: string[]) { return classes.join(" "); } +/** + * Returns a promise that resolves after the specified amount of time + */ export function sleep(ms: number): Promise<void> { return new Promise(r => setTimeout(r, ms)); } |