MIDIPort: thuộc tính type
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 type của giao diện MIDIPort trả về loại của cổng, cho biết đây là cổng MIDI đầu vào hay đầu ra.
Giá trị
Một chuỗi chứa loại của cổng, một trong các giá trị:
Ví dụ
Ví dụ sau đây lặp qua tất cả các cổng đầu vào và in type của từng cổng ra console.
js
for (const entry of midiAccess.inputs) {
const input = entry[1];
console.log(input.type); // should always be input
}
Thông số kỹ thuật
| Specification |
|---|
| Web MIDI API> # dom-midiport-type> |