Skip to content

Commit

Permalink
chore: add missing jsdoc
Browse files Browse the repository at this point in the history
  • Loading branch information
SukkaW committed Sep 8, 2024
1 parent 5798367 commit 8cca7ee
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/use-is-online/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ const getSnapshot: Parameters<typeof useSyncExternalStore>[1] = () => {
return navigator.onLine;
};

export function usePageVisibility() {
/** @see https://foxact.skk.moe/use-is-online */
export function useIsOnline() {
return useSyncExternalStore(
subscribe,
getSnapshot,
Expand Down
1 change: 1 addition & 0 deletions src/use-page-visibility/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const getSnapshot: Parameters<typeof useSyncExternalStore>[1] = () => {
return !document.hidden;
};

/** @see https://foxact.skk.moe/use-page-visibility */
export function usePageVisibility() {
return useSyncExternalStore(
handlePageVisibilityChange,
Expand Down
3 changes: 3 additions & 0 deletions src/use-typescript-happy-callback/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { useCallback as useCallbackFromReact } from 'react';

/** @see https://foxact.skk.moe/use-typescript-happy-callback */
export const useTypeScriptHappyCallback: <Args extends unknown[], R>(
fn: (...args: Args) => R,
deps: React.DependencyList
) => (...args: Args) => R = useCallbackFromReact;

/** @see https://foxact.skk.moe/use-typescript-happy-callback */
export const useCallback = useTypeScriptHappyCallback;

0 comments on commit 8cca7ee

Please sign in to comment.