AbsoluteOrientationSensor: bộ khởi tạo AbsoluteOrientationSensor()

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.

Bộ khởi tạo AbsoluteOrientationSensor() tạo một đối tượng AbsoluteOrientationSensor mới, mô tả hướng vật lý của thiết bị so với hệ tọa độ tham chiếu của Trái Đất.

Cú pháp

js
new AbsoluteOrientationSensor()
new AbsoluteOrientationSensor(options)

Tham số

options Optional

Các tùy chọn gồm:

frequency Optional

Số lần lấy mẫu mong muốn mỗi giây, tức số lần sự kiện reading sẽ được gọi mỗi giây. Có thể dùng số nguyên hoặc số thập phân, với số thập phân cho tần suất nhỏ hơn một giây. Tần suất đọc thực tế phụ thuộc vào phần cứng của thiết bị và vì thế có thể thấp hơn mức yêu cầu.

referenceFrame Optional

Hoặc 'device' hoặc 'screen'. Mặc định là 'device'.

Thông số kỹ thuật

Thông số kỹ thuật
Orientation Sensor
# dom-absoluteorientationsensor-absoluteorientationsensor

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

Xem thêm