Skip to content

Commit

Permalink
More Corrections
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelVerdon committed Feb 26, 2025
1 parent acc6be8 commit e876517
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
13 changes: 1 addition & 12 deletions packages/database/lib/modular/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ReactNativeFirebase } from '@react-native-firebase/app';
import { DataSnapshot, FirebaseDatabaseTypes, Query, QueryConstraint } from '..';
import { FirebaseDatabaseTypes } from '..';

import FirebaseApp = ReactNativeFirebase.FirebaseApp;
import Database = FirebaseDatabaseTypes.Module;
Expand Down Expand Up @@ -228,16 +228,5 @@ export function increment(delta: number): object;
*/
export declare function enableLogging(enabled: boolean, persistent?: boolean): any;

/**
* Detaches a callback previously attached with the corresponding on*() (onValue, onChildAdded) listener.
* Note: This is not the recommended way to remove a listener.
* Instead, please use the returned callback function from the respective on* callbacks.
*
* @param query
* @param eventType
* @param callback
*/
export declare function off(query: Query, eventType?: EventType, callback?: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown): void;

export * from './query';
export * from './transaction';
18 changes: 18 additions & 0 deletions packages/database/lib/modular/query.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,24 @@ export function setWithPriority(
*/
export function get(query: Query): Promise<DataSnapshot>;

/**
* Detaches a callback previously attached with the corresponding on*() (onValue, onChildAdded) listener.
* Note: This is not the recommended way to remove a listener. Instead, please use the returned callback function from the respective on* callbacks.
* Detach a callback previously attached with on*(). Calling off() on a parent listener will not automatically remove listeners registered on child nodes, off() must also be called on any child listeners to remove the callback.
* If a callback is not specified, all callbacks for the specified eventType will be removed.
* Similarly, if no eventType is specified, all callbacks for the Reference will be removed.
* Individual listeners can also be removed by invoking their unsubscribe callbacks.
*
* @param query - The query to run
* @param eventType One of the following strings: "value", "child_added", "child_changed", "child_removed", or "child_moved.
* @param callback
*/
export declare function off(
query: Query,
eventType?: EventType,
callback?: (snapshot: DataSnapshot, previousChildName?: string | null) => unknown,
): void;

/**
* Gets a `Reference` for the location at the specified relative path.
*
Expand Down

0 comments on commit e876517

Please sign in to comment.