MIDIConnectionEvent.MIDIConnectionEvent()

Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.

The MIDIConnectionEvent() constructor creates a new MIDIConnectionEvent object. Typically this constructor is not used as events are created when a new port becomes available, and the object is passed to the MIDIAccess.onstagechange event handler.

Syntax

new MIDIConnectionEvent(type);
new MIDIConnectionEvent(type, MIDIConnectionEventInit);

Parameters

type

A DOMString with one of "connect" or "disconnect".

MIDIConnectionEventInitOptional

A dictionary including the following fields:

port

The MIDIPort instance representing the port that has connected or disconnected.

bubbles Optional

A boolean value indicating whether the event bubbles. The default is false.

cancelable Optional

A boolean value indicating whether the event can be cancelled. The default is false.

composed Optional

A boolean value indicating whether the event will trigger listeners outside of a shadow root (see Event.composed for more details). The default is false.

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
MIDIConnectionEvent
43
79
No
No
30
No
43
43
No
30
No
4.0

© 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/MIDIConnectionEvent/MIDIConnectionEvent