Navigator: thuộc tính serial

Khả dụng hạn chế

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

Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

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

Thuộc tính chỉ đọc serial của giao diện Navigator trả về đối tượng Serial đại diện cho điểm vào Web Serial API.

Khi nhận được, phiên bản tương tự của đối tượng Serial sẽ luôn được trả về.

Giá trị

Đối tượng Serial.

Ví dụ

Ví dụ sau sử dụng phương thức getPorts() để khởi tạo danh sách các cổng khả dụng.

js
navigator.serial.getPorts().then((ports) => {
  // Initialize the list of available ports with `ports` on page load.
});

Thông số kỹ thuật

Thông số kỹ thuật
Web Serial API
# extensions-to-the-navigator-interface

Khả năng tương thích của trình duyệt

Xem thêm