<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@firebase/database](./database.md) &gt; [onDisconnect](./database.ondisconnect.md)

## onDisconnect() function

Returns an `OnDisconnect` object - see [Enabling Offline Capabilities in JavaScript](https://firebase.google.com/docs/database/web/offline-capabilities) for more information on how to use it.

<b>Signature:</b>

```typescript
export declare function onDisconnect(ref: Reference): OnDisconnect;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  ref | [Reference](./database.reference.md) | The reference to add OnDisconnect triggers for. |

<b>Returns:</b>

[OnDisconnect](./database.ondisconnect.md)

