Skip to content

Commit

Permalink
Updated docstring for off (#6407)
Browse files Browse the repository at this point in the history
Updated recommendations for adding/removing event callbacks in RTDB.
  • Loading branch information
maneesht authored Jul 19, 2022
1 parent 691292b commit 0748364
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/database/src/api/Reference_impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1600,12 +1600,11 @@ export function onChildRemoved(
export { EventType };

/**
* Detaches a callback previously attached with `on()`.
* 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()`. Note that if `on()` was
* called multiple times with the same eventType and callback, the callback
* will be called multiple times for each event, and `off()` must be called
* multiple times to remove the callback. Calling `off()` on a parent listener
* 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.
*
Expand Down

0 comments on commit 0748364

Please sign in to comment.