MIDIPort: thuộc tính name

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 name của giao diện MIDIPort trả về tên hệ thống của cổng.

Giá trị

Một chuỗi chứa tên hệ thống 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 tên của từng cổng ra console.

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

Thông số kỹ thuật

Specification
Web MIDI API
# dom-midiport-name

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