Table of Contents

Class USB

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll
NOTE
Experimental
The USB interface of the WebUSB API provides attributes and methods for finding and connecting USB devices from a web page.
[Value("USB")]
public class USB : EventTarget
Inheritance
USB
Inherited Members

Remarks

Use Usb to get access to the USB object.

The USB interface inherits from EventTarget.

See also on MDN

Constructors

USB()

public USB()

Properties

Onconnect

[Value("onconnect")]
public EventHandlerNonNull Onconnect { get; set; }

Property Value

EventHandlerNonNull

Ondisconnect

[Value("ondisconnect")]
public EventHandlerNonNull Ondisconnect { get; set; }

Property Value

EventHandlerNonNull

Methods

GetDevices()

NOTE
Experimental
The getDevices method of the USB interface
returns a {{JSxRef("Promise")}} that resolves with an array of USBDevice
objects for paired attached devices. For information on pairing devices, see
RequestDevice(USBDeviceRequestOptions).
[Value("getDevices")]
public Task<List<USBDevice>> GetDevices()

Returns

Task<List<USBDevice>>

A {{JSxRef("Promise")}} that resolves with an array of USBDevice
objects.

Remarks

RequestDevice(USBDeviceRequestOptions)

NOTE
Experimental
The requestDevice() method of the USB
interface returns a Promise that resolves with an instance of
USBDevice if the specified device is found. Calling this function
triggers the user agent&apos;s pairing flow.
[Value("requestDevice")]
public Task<USBDevice> RequestDevice(USBDeviceRequestOptions options)

Parameters

options USBDeviceRequestOptions

Returns

Task<USBDevice>

A {{JSxRef("Promise")}} that resolves with an instance of USBDevice.

Remarks