From a85ec594a77557e5f48c4cf1aa33680e0da94654 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Fri, 25 Nov 2022 19:25:35 +0100 Subject: [skip ci] docs docs docs --- src/utils/misc.tsx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/utils/misc.tsx') 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(factory: () => Promise, 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 { return new Promise(r => setTimeout(r, ms)); } -- cgit