Node USB
    Preparing search index...

    Class WebUSB

    Implements

    • USB
    Index

    Constructors

    Properties

    authorisedDevices: Set<USBDeviceFilter> = ...
    emitter: EventEmitter<DefaultEventMap> = ...
    knownDevices: Map<Device, WebUSBDevice> = ...

    Accessors

    • set onconnect(fn: (ev: USBConnectionEvent) => void): void

      Parameters

      • fn: (ev: USBConnectionEvent) => void

      Returns void

    • set ondisconnect(fn: (ev: USBConnectionEvent) => void): void

      Parameters

      • fn: (ev: USBConnectionEvent) => void

      Returns void

    Methods

    • Parameters

      • type: "connect" | "disconnect"
      • listener: (this: this, ev: USBConnectionEvent) => void

      Returns void

    • Parameters

      • type: "connect" | "disconnect"
      • listener: EventListener

      Returns void

    • Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise.

      MDN Reference

      Parameters

      • _event: Event

      Returns boolean

    • Gets all allowed Web USB devices which are connected

      Returns Promise<USBDevice[]>

      Promise containing an array of devices

    • Parameters

      • type: "connect" | "disconnect"
      • callback: (this: this, ev: USBConnectionEvent) => void

      Returns void

    • Parameters

      • type: "connect" | "disconnect"
      • callback: EventListener

      Returns void

    • Requests a single Web USB device

      Parameters

      • Optionaloptions: USBDeviceRequestOptions

        The options to use when scanning

      Returns Promise<USBDevice>

      Promise containing the selected device