MIDIPort: thuộc tính id

Khả dụng hạn chế

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 id của giao diện MIDIPort trả về ID duy nhất của cổng.

Giá trị

Một chuỗi chứa ID của cổng.

Ví dụ

Ví dụ sau đây lặp qua tất cả các cổng đầu vào và in id của từng cổng ra console.

js
for (const entry of midiAccess.inputs) {
  const input = entry[1];
  console.log(input.id);
}

Thông số kỹ thuật

Thông số kỹ thuật
Web MIDI API
# dom-midiport-id

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