Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Webusb

Hierarchy

Index

Constructors

constructor

Properties

Private Optional __DEVICE__

__DEVICE__: USBDevice

claimInterface

claimInterface: number

Optional debug

debug: undefined | false | true

Optional productId

productId: undefined | number

selectConfiguration

selectConfiguration: number

Optional serialNumber

serialNumber: undefined | string

Static defaultMaxListeners

defaultMaxListeners: number

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

eventNames

  • eventNames(): Array<string | symbol>
  • Returns Array<string | symbol>

getDevices

  • getDevices(): Promise<undefined | USBDevice[]>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount(type: string | symbol): number
  • Parameters

    • type: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

off

  • off(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

on

  • on(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

onConnect

  • onConnect(cb: (e: USBConnectionEvent) => void): void
  • Parameters

    • cb: (e: USBConnectionEvent) => void
        • (e: USBConnectionEvent): void
        • Parameters

          • e: USBConnectionEvent

          Returns void

    Returns void

onError

  • onError(cb: (e: any) => void): void
  • Parameters

    • cb: (e: any) => void
        • (e: any): void
        • Parameters

          • e: any

          Returns void

    Returns void

once

  • once(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

Private openDevice

  • openDevice(device: USBDevice): Promise<boolean>
  • Parameters

    • device: USBDevice

    Returns Promise<boolean>

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

removeAllListeners

  • removeAllListeners(event?: string | symbol): this
  • Parameters

    • Optional event: string | symbol

    Returns this

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): this
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns this

requestDevice

  • requestDevice(filters: Array<USBDeviceFilter>): Promise<undefined | USBDevice>
  • Parameters

    • filters: Array<USBDeviceFilter>

    Returns Promise<undefined | USBDevice>

setMaxListeners

  • setMaxListeners(n: number): this
  • Parameters

    • n: number

    Returns this

transferIn

  • transferIn(endpointNumber: number, length: number): Promise<Buffer>
  • Parameters

    • endpointNumber: number
    • length: number

    Returns Promise<Buffer>

transferOut

  • transferOut(endpointNumber: number, data: ArrayBuffer[]): Promise<void>
  • Parameters

    • endpointNumber: number
    • data: ArrayBuffer[]

    Returns Promise<void>

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Generated using TypeDoc