Interface MIDIPort
connection: MIDIPortConnectionState;
id: string;
manufacturer: string | null;
name: string | null;
onstatechange: ((this: MIDIPort, ev: MIDIConnectionEvent) => any) | null;
state: MIDIPortDeviceState;
type: MIDIPortType;
version: string | null;
addEventListener<K extends "statechange">(
type: K,
listener: (this: MIDIPort, ev: MIDIPortEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): void;
addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): void;
close(): Promise<MIDIPort>;
dispatchEvent(event: Event): boolean;
open(): Promise<MIDIPort>;
removeEventListener<K extends "statechange">(
type: K,
listener: (this: MIDIPort, ev: MIDIPortEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): void;
removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): void;
}
Hierarchy
- EventTarget
- MIDIPort
Index
Properties
Methods
Properties
Readonlyconnection
The connection read-only property of the MIDIPort interface returns the connection state of the port.
Readonlyid
The id read-only property of the MIDIPort interface returns the unique ID of the port.
Readonlymanufacturer
The manufacturer read-only property of the MIDIPort interface returns the manufacturer of the port.
Readonlyname
The name read-only property of the MIDIPort interface returns the system name of the port.
onstatechange
Readonlystate
The state read-only property of the MIDIPort interface returns the state of the port.
Readonlytype
The type read-only property of the MIDIPort interface returns the type of the port, indicating whether this is an input or output MIDI port.
Readonlyversion
The version read-only property of the MIDIPort interface returns the version of the port.
Methods
addEventListener
- addEventListener<K extends "statechange">(
type: K,
listener: (this: MIDIPort, ev: MIDIPortEventMap[K]) => any,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Type Parameters
- K extends "statechange"
Parameters
- type: K
- listener: (this: MIDIPort, ev: MIDIPortEventMap[K]) => any
Optionaloptions: boolean | AddEventListenerOptions
Returns void
- addEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | AddEventListenerOptions,
): voidThe
addEventListener()method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | AddEventListenerOptions
Returns void
close
The
close()method of the MIDIPort interface makes the access to the MIDI device connected to thisMIDIPortunavailable.Returns Promise<MIDIPort>
dispatchEvent
The
dispatchEvent()method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order.Parameters
- event: Event
Returns boolean
open
The
open()method of the MIDIPort interface makes the MIDI device connected to thisMIDIPortexplicitly available.Returns Promise<MIDIPort>
removeEventListener
- removeEventListener<K extends "statechange">(
type: K,
listener: (this: MIDIPort, ev: MIDIPortEventMap[K]) => any,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Type Parameters
- K extends "statechange"
Parameters
- type: K
- listener: (this: MIDIPort, ev: MIDIPortEventMap[K]) => any
Optionaloptions: boolean | EventListenerOptions
Returns void
- removeEventListener(
type: string,
listener: EventListenerOrEventListenerObject,
options?: boolean | EventListenerOptions,
): voidThe
removeEventListener()method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target.Parameters
- type: string
- listener: EventListenerOrEventListenerObject
Optionaloptions: boolean | EventListenerOptions
Returns void
The
MIDIPortinterface of the Web MIDI API represents a MIDI input or output port. Available only in secure contexts.MDN Reference