Skip to content

MIDIPort

Defined in: src/MIDIPort.ts:8

Base interface for a single MIDI input or output port. Mirrors the Web MIDI API MIDIPort.

  • MIDIEventTarget

readonly connection: "open" | "closed" | "pending"

Defined in: src/MIDIPort.ts:23

The port’s connection state.


readonly id: string

Defined in: src/MIDIPort.ts:10

A unique, stable id for this port.


readonly manufacturer: string

Defined in: src/MIDIPort.ts:12

The manufacturer of the port, if known.


readonly name: string

Defined in: src/MIDIPort.ts:14

The display name of the port.


onstatechange: ((e) => void) | null

Defined in: src/MIDIPort.ts:31

Handler invoked when the port’s state changes.


readonly state: "connected" | "disconnected"

Defined in: src/MIDIPort.ts:21

Whether the underlying device is "connected" or "disconnected".


readonly type: "input" | "output"

Defined in: src/MIDIPort.ts:16

Whether this is an "input" or "output" port.


readonly version: string

Defined in: src/MIDIPort.ts:18

The version of the port, if known.

addEventListener(type, listener, options?): void

Defined in: src/MIDIPort.ts:33

"statechange"

(this, e) => any

boolean | AddEventListenerOptions

void

MIDIEventTarget.addEventListener

addEventListener(type, listener, options?): void

Defined in: src/MIDIPort.ts:38

string

EventListenerOrEventListenerObject

boolean | AddEventListenerOptions

void

MIDIEventTarget.addEventListener


close(): Promise<void>

Defined in: src/MIDIPort.ts:28

Close the port.

Promise<void>


dispatchEvent(event): boolean

Defined in: src/MIDIEventTarget.ts:23

Event

boolean

MIDIEventTarget.dispatchEvent


open(): Promise<void>

Defined in: src/MIDIPort.ts:26

Open the port, resolving when it is ready for I/O.

Promise<void>


removeEventListener(type, listener, options?): void

Defined in: src/MIDIEventTarget.ts:18

string

EventListenerOrEventListenerObject

boolean | EventListenerOptions

void

MIDIEventTarget.removeEventListener