midi/access
Interfaces
MIDIAccessInstance
Defined in: dom/src/midi/access.ts:44
Properties
destroy
destroy: () => void;
Defined in: dom/src/midi/access.ts:52
Returns
void
getServerState
getServerState: () => MIDIAccessState;
Defined in: dom/src/midi/access.ts:49
Snapshot for server side rendering. Always the initial state.
Returns
getState
getState: () => MIDIAccessState;
Defined in: dom/src/midi/access.ts:47
Returns
request
request: (options?) => void;
Defined in: dom/src/midi/access.ts:46
Request MIDI access. Safe to call more than once.
Parameters
| Parameter | Type |
|---|---|
options? | MIDIAccessOptions |
Returns
void
subscribe
subscribe: (listener) => () => void;
Defined in: dom/src/midi/access.ts:51
Parameters
| Parameter | Type |
|---|---|
listener | () => void |
Returns
unsubscribe function
() => void
Type Aliases
MIDIAccessOptions
type MIDIAccessOptions = object;
Defined in: dom/src/midi/access.ts:14
Properties
sysex?
optional sysex?: boolean;
Defined in: dom/src/midi/access.ts:23
Ask for system exclusive messages as well.
Browsers treat this as a separate, more sensitive permission, so leave it off unless the app actually reads or sends sysex.
Default
false
MIDIAccessState
type MIDIAccessState = object;
Defined in: dom/src/midi/access.ts:26
Properties
error
readonly error: MIDIAccessError | null;
Defined in: dom/src/midi/access.ts:28
inputs
readonly inputs: readonly MIDIInput[];
Defined in: dom/src/midi/access.ts:35
The inputs currently connected, in the order MIDIAccess lists them.
Kept up to date as devices are plugged in and unplugged, so a UI listing
the devices does not have to watch statechange itself.
midiAccess
readonly midiAccess: MIDIAccess | null;
Defined in: dom/src/midi/access.ts:27
Functions
createMIDIAccess()
function createMIDIAccess(): MIDIAccessInstance;
Defined in: dom/src/midi/access.ts:83
Request MIDI access in the browser.
The returned instance holds the state and notifies subscribers when it changes, so it can be consumed from any framework.