Skip to content

Commit

Permalink
docs: tweak jsdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
andipaetzold committed Oct 12, 2023
1 parent 337ce88 commit 52949b2
Show file tree
Hide file tree
Showing 27 changed files with 81 additions and 81 deletions.
6 changes: 3 additions & 3 deletions src/app-check/useAppCheckToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const onChange: UseListenOnChange<AppCheckTokenResult | null, Error, AppCheck> =
* Returns and updates the current App Check token
* @param appCheck Firebase App Check instance
* @returns App Check token, loading state, and error
* value: App Check token; `undefined` if token is currently being fetched, or an error occurred
* loading: `true` while fetching the token; `false` if the token was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: App Check token; `undefined` if token is currently being fetched, or an error occurred
* - loading: `true` while fetching the token; `false` if the token was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useAppCheckToken(appCheck: AppCheck): UseAppCheckToken {
return useListen(appCheck, onChange, () => true, LoadingState);
Expand Down
6 changes: 3 additions & 3 deletions src/auth/useAuthIdToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const onChange: UseListenOnChange<string | null, AuthError, Auth> = (stableAuth,
* Returns and updates the JWT of the currently authenticated user
* @param auth Firebase Auth instance
* @returns JWT, loading state, and error
* value: JWT; `undefined` if the JWT is currently being fetched, or an error occurred
* loading: `true` while fetching the JWT; `false` if the JWT was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: JWT; `undefined` if the JWT is currently being fetched, or an error occurred
* - loading: `true` while fetching the JWT; `false` if the JWT was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useAuthIdToken(auth: Auth): UseAuthIdTokenResult {
return useListen(auth, onChange, () => true, LoadingState);
Expand Down
6 changes: 3 additions & 3 deletions src/auth/useAuthIdTokenResult.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ const onChange: UseListenOnChange<IdTokenResult | null, AuthError, Auth> = (stab
* Returns and updates the deserialized JWT of the currently authenticated user
* @param auth Firebase Auth instance
* @returns Deserialized JWT, loading state, and error
* value: Deserialized JWT; `undefined` if the JWT is currently being fetched, or an error occurred
* loading: `true` while fetching JWT; `false` if the JWT was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: Deserialized JWT; `undefined` if the JWT is currently being fetched, or an error occurred
* - loading: `true` while fetching JWT; `false` if the JWT was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useAuthIdTokenResult(auth: Auth): UseAuthIdTokenResultResult {
return useListen(auth, onChange, () => true, LoadingState);
Expand Down
6 changes: 3 additions & 3 deletions src/auth/useAuthState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ const onChange: UseListenOnChange<User | null, AuthError, Auth> = (stableAuth, n
* Returns and updates the currently authenticated user
* @param auth Firebase Auth instance
* @returns User, loading state, and error
* value: User; `undefined` if user is currently being fetched, or an error occurred
* loading: `true` while fetching the user; `false` if the user was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: User; `undefined` if user is currently being fetched, or an error occurred
* - loading: `true` while fetching the user; `false` if the user was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useAuthState(auth: Auth): UseAuthStateResult {
return useListen(auth, onChange, () => true, auth.currentUser ? auth.currentUser : LoadingState);
Expand Down
6 changes: 3 additions & 3 deletions src/database/useObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export type UseObjectResult = ValueHookResult<DataSnapshot, Error>;
* Returns the DataSnapshot of the Realtime Database query
* @param query Realtime Database query
* @returns User, loading state, and error
* value: DataSnapshot; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: DataSnapshot; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useObject(query: Query | undefined | null): UseObjectResult {
return useListen(query ?? undefined, onValue, isQueryEqual, LoadingState);
Expand Down
6 changes: 3 additions & 3 deletions src/database/useObjectOnce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export type UseObjectOnceResult = ValueHookResult<DataSnapshot, Error>;
* Returns and updates the DataSnapshot of the Realtime Database query. Does not update the DataSnapshot once initially fetched
* @param query Realtime Database query
* @returns User, loading state, and error
* value: DataSnapshot; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: DataSnapshot; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useObjectOnce(query: Query | undefined | null): UseObjectOnceResult {
const getData = useCallback((stableQuery: Query) => get(stableQuery), []);
Expand Down
6 changes: 3 additions & 3 deletions src/database/useObjectValue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export interface UseObjectValueOptions<Value> {
* `converter`: Function to extract the desired data from the DataSnapshot. Similar to Firestore converters. Default: `snap.val()`.
* `initialValue`: Value that is returned while the object is being fetched.
* @returns User, loading state, and error
* value: Object value; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: Object value; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useObjectValue<Value = unknown>(
query: Query | undefined | null,
Expand Down
6 changes: 3 additions & 3 deletions src/database/useObjectValueOnce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export interface UseObjectValueOnceOptions<Value> {
* @param options Options to configure how the object is fetched
* `converter`: Function to extract the desired data from the DataSnapshot. Similar to Firestore converters. Default: `snap.val()`.
* @returns User, loading state, and error
* value: Object value; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: Object value; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useObjectValueOnce<Value = unknown>(
query: Query | undefined | null,
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useCountFromServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ async function getData(stableQuery: Query<unknown>): Promise<number> {
* Returns the number of documents in the result set of a Firestore Query. Does not update the count once initially calculated.
* @param query Firestore query whose result set size is calculated
* @returns Size of the result set, loading state, and error
* value: Size of the result set; `undefined` if the result set size is currently being calculated, or an error occurred
* loading: `true` while calculating the result size set; `false` if the result size set was calculated successfully or an error occurred
* error: `undefined` if no error occurred
* - value: Size of the result set; `undefined` if the result set size is currently being calculated, or an error occurred
* - loading: `true` while calculating the result size set; `false` if the result size set was calculated successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useCountFromServer(query: Query<unknown> | undefined | null): UseCountFromServerResult {
return useGet(query ?? undefined, getData, isQueryEqual);
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export interface UseDocumentOptions {
* @param reference Firestore DocumentReference that will be subscribed to
* @param options Options to configure the subscription
* @returns Document snapshot, loading state, and error
* value: DocumentSnapshot; `undefined` if document does not exist, is currently being fetched, or an error occurred
* loading: `true` while fetching the document; `false` if the document was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: DocumentSnapshot; `undefined` if document does not exist, is currently being fetched, or an error occurred
* - loading: `true` while fetching the document; `false` if the document was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useDocument<Value extends DocumentData = DocumentData>(
reference: DocumentReference<Value> | undefined | null,
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useDocumentData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export interface UseDocumentDataOptions<Value extends DocumentData = DocumentDat
* @param options Options to configure the subscription
* `initialValue`: Value that is returned while the document is being fetched.
* @returns Document data, loading state, and error
* value: Document data; `undefined` if document does not exist, is currently being fetched, or an error occurred
* loading: `true` while fetching the document; `false` if the document was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: Document data; `undefined` if document does not exist, is currently being fetched, or an error occurred
* - loading: `true` while fetching the document; `false` if the document was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useDocumentData<Value extends DocumentData = DocumentData>(
reference: DocumentReference<Value> | undefined | null,
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useDocumentDataOnce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export interface UseDocumentDataOnceOptions {
* @param reference Firestore DocumentReference that will be subscribed to
* @param options Options to configure how the document is fetched
* @returns Document data, loading state, and error
* value: Document data; `undefined` if document does not exist, is currently being fetched, or an error occurred
* loading: `true` while fetching the document; `false` if the document was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: Document data; `undefined` if document does not exist, is currently being fetched, or an error occurred
* - loading: `true` while fetching the document; `false` if the document was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useDocumentDataOnce<Value extends DocumentData = DocumentData>(
reference: DocumentReference<Value> | undefined | null,
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useDocumentOnce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export interface UseDocumentOnceOptions {
* @param reference Firestore DocumentReference that will be fetched
* @param options Options to configure how the document is fetched
* @returns DocumentSnapshot, loading state, and error
* value: DocumentSnapshot; `undefined` if document does not exist, is currently being fetched, or an error occurred
* loading: `true` while fetching the document; `false` if the document was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: DocumentSnapshot; `undefined` if document does not exist, is currently being fetched, or an error occurred
* - loading: `true` while fetching the document; `false` if the document was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useDocumentOnce<Value extends DocumentData = DocumentData>(
reference: DocumentReference<Value> | undefined | null,
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useQueries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export interface UseQueriesOptions {
* @param queries Firestore queries that will be subscribed to
* @param options Options to configure the subscription
* @returns Array with tuple for each query:
* value: QuerySnapshot; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: QuerySnapshot; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useQueries<Values extends ReadonlyArray<DocumentData> = ReadonlyArray<DocumentData>>(
queries: { [Index in keyof Values]: Query<Values[Index]> },
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useQueriesData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ export interface UseQueriesDataOptions {
* @param queries Firestore queries that will be subscribed to
* @param options Options to configure the subscription
* @returns Array with tuple for each query:
* value: Query data; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: Query data; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useQueriesData<Values extends ReadonlyArray<DocumentData> = ReadonlyArray<DocumentData>>(
queries: { [Index in keyof Values]: Query<Values[Index]> },
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useQueriesDataOnce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export interface UseQueriesDataOnceOptions {
* @param queries Firestore queries that will be fetched
* @param options Options to configure how the queries are fetched
* @returns Array with tuple for each query:
* value: Query data; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: Query data; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useQueriesDataOnce<Values extends ReadonlyArray<DocumentData> = ReadonlyArray<DocumentData>>(
queries: { [Index in keyof Values]: Query<Values[Index]> },
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useQueriesOnce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export interface UseQueriesOnceOptions {
* @param queries Firestore queries that will be fetched
* @param options Options to configure how the queries are fetched
* @returns Array with tuple for each query:
* value: QuerySnapshot; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: QuerySnapshot; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useQueriesOnce<Values extends ReadonlyArray<DocumentData> = ReadonlyArray<DocumentData>>(
queries: { [Index in keyof Values]: Query<Values[Index]> },
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export interface UseQueryOptions {
* @param query Firestore query that will be subscribed to
* @param options Options to configure the subscription
* @returns QuerySnapshot, loading, and error
* value: QuerySnapshot; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: QuerySnapshot; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useQuery<Value extends DocumentData = DocumentData>(
query: Query<Value> | undefined | null,
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useQueryData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export interface UseQueryDataOptions<Value extends DocumentData = DocumentData>
* @param options Options to configure the subscription
* `initialValue`: Value that is returned while the query is being fetched.
* @returns Query data, loading state, and error
* value: Query data; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: Query data; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useQueryData<Value extends DocumentData = DocumentData>(
query: Query<Value> | undefined | null,
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useQueryDataOnce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ export interface UseQueryDataOnceOptions {
* @param query Firestore query that will be fetched
* @param options Options to configure how the query is fetched
* @returns Query data, loading state, and error
* value: Query data; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: Query data; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useQueryDataOnce<Value extends DocumentData = DocumentData>(
query: Query<Value> | undefined | null,
Expand Down
6 changes: 3 additions & 3 deletions src/firestore/useQueryOnce.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export interface UseQueryOnceOptions {
* @param query Firestore query that will be fetched
* @param options Options to configure how the query is fetched
* @returns QuerySnapshot, loading state, and error
* value: QuerySnapshot; `undefined` if query is currently being fetched, or an error occurred
* loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: QuerySnapshot; `undefined` if query is currently being fetched, or an error occurred
* - loading: `true` while fetching the query; `false` if the query was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useQueryOnce<Value extends DocumentData = DocumentData>(
query: Query<Value> | undefined | null,
Expand Down
6 changes: 3 additions & 3 deletions src/messaging/useMessagingToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export interface UseMessagingTokenOptions {
* @param messaging Firebase Messaging instance
* @param options Options to configure how the token will be fetched
* @returns Token, loading state, and error
* value: Messaging token; `undefined` if token is currently being fetched, or an error occurred
* loading: `true` while fetching the token; `false` if the token was fetched successfully or an error occurred
* error: `undefined` if no error occurred
* - value: Messaging token; `undefined` if token is currently being fetched, or an error occurred
* - loading: `true` while fetching the token; `false` if the token was fetched successfully or an error occurred
* - error: `undefined` if no error occurred
*/
export function useMessagingToken(messaging: Messaging, options?: UseMessagingTokenOptions): UseMessagingTokenResult {
return useGet(
Expand Down
Loading

0 comments on commit 52949b2

Please sign in to comment.