---
title: USB.ondisconnect
slug: Web/API/USB/ondisconnect
tags:
  - API
  - Method
  - Reference
  - USB
  - WebUSB
  - WebUSB API
  - ondisconnect
browser-compat: api.USB.ondisconnect
---
{{APIRef("WebUSB API")}}{{SeeCompatTable}}{{securecontext_header}}

The **`ondisconnect`** property of the {{domxref("USB")}} is an
event handler called whenever a paired device is disconnected. It is passed an instance of {{domxref("USBConnectionEvent")}}.

## Syntax

```js
USB.ondisconnect = disconnectFunction
```

## Specifications

{{Specifications}}

## Browser compatibility

{{Compat}}
