_onStateChange(e) {

    let event = {
      timestamp: WebMidi.time,
      target: this,
      port: this // for consistency
    };

    if (e.port.connection === "open") {

      /**
       * Event emitted when the `Input` has been opened by calling the [`open()`]{@link #open}
       * method.
       *
       * @event Input#opened
       * @type {object}
       * @property {number} timestamp The moment (DOMHighResTimeStamp) when the event occurred (in
       * milliseconds since the navigation start of the document).
       * @property {string} type `opened`
       * @property {Input} target The object that dispatched the event.
       * @property {Input} port The `Input` that triggered the event.
       */
      event.type = "opened";
      this.emit("opened", event);

    } else if (e.port.connection === "closed" && e.port.state === "connected") {

      /**
       * Event emitted when the `Input` has been closed by calling the
       * [`close()`]{@link #close} method.
       *
       * @event Input#closed
       * @type {object}
       * @property {number} timestamp The moment (DOMHighResTimeStamp) when the event occurred (in
       * milliseconds since the navigation start of the document).
       * @property {string} type `closed`
       * @property {Input} target The object that dispatched the event.
       * @property {Input} port The `Input` that triggered the event.
       */
      event.type = "closed";
      this.emit("closed", event);

    } else if (e.port.connection === "closed" && e.port.state === "disconnected") {

      /**
       * Event emitted when the `Input` becomes unavailable. This event is typically fired
       * when the MIDI device is unplugged.
       *
       * @event Input#disconnected
       * @type {object}
       * @property {number} timestamp The moment (DOMHighResTimeStamp) when the event occurred (in
       * milliseconds since the navigation start of the document).
       * @property {string} type `disconnected`
       * @property {Input} port Object with properties describing the {@link Input} that was
       * disconnected. This is not the actual `Input` as it is no longer available.
       * @property {Input} target The object that dispatched the event.
       */
      event.type = "disconnected";
      event.port = {
        connection: e.port.connection,
        id: e.port.id,
        manufacturer: e.port.manufacturer,
        name: e.port.name,
        state: e.port.state,
        type: e.port.type
      };
      this.emit("disconnected", event);

    } else if (e.port.connection === "pending" && e.port.state === "disconnected") {
      // I don't see the need to forward that...
    } else {
      console.warn("This statechange event was not caught: ", e.port.connection, e.port.state);
    }

  }
Executed when a `"statechange"` event occurs.

@param e
@private