diff --git a/packages/database/lib/modular/index.d.ts b/packages/database/lib/modular/index.d.ts index 7427d5bf6b..c61df0088a 100644 --- a/packages/database/lib/modular/index.d.ts +++ b/packages/database/lib/modular/index.d.ts @@ -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; @@ -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'; diff --git a/packages/database/lib/modular/query.d.ts b/packages/database/lib/modular/query.d.ts index 1ae003ca32..72bc9a9102 100644 --- a/packages/database/lib/modular/query.d.ts +++ b/packages/database/lib/modular/query.d.ts @@ -903,6 +903,24 @@ export function setWithPriority( */ export function get(query: Query): Promise; +/** + * 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. *