MIDIMessageEvent: thuộc tính data

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

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

Thuộc tính chỉ đọc data của giao diện MIDIMessageEvent trả về các byte dữ liệu MIDI của một tin nhắn MIDI.

Giá trị

Một Uint8Array.

Ví dụ

Trong ví dụ sau, các sự kiện midimessage được lắng nghe trên tất cả các cổng đầu vào. Khi nhận được tin nhắn, giá trị của data được in ra console.

js
inputs.forEach((input) => {
  input.onmidimessage = (message) => {
    console.log(message.data);
  };
});

Thông số kỹ thuật

Specification
Web MIDI API
# dom-midimessageevent-data

Tương thích trình duyệt