此页面由社区从英文翻译而来。了解更多并加入 MDN Web Docs 社区。

View in English Always switch to English

AbsoluteOrientationSensor:AbsoluteOrientationSensor() 构造函数

Limited availability

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

安全上下文: 此特性仅在一些支持的浏览器安全上下文(HTTPS)中可用。

AbsoluteOrientationSensor() 构造函数创建一个描述设备相对于地球参考坐标系的物理方向的新 AbsoluteOrientationSensor 对象。

语法

js
new AbsoluteOrientationSensor()
new AbsoluteOrientationSensor(options)

参数

options 可选

选项如下:

frequency 可选

每秒采样的期望次数,即每秒触发 reading 事件的次数。可以使用整数或小数(用于频率小于一秒的情况)。实际读取频率取决于设备硬件,因此可能低于请求值。

referenceFrame 可选

可以是 'device''screen'。默认为 'device'

规范

Specification
Orientation Sensor
# dom-absoluteorientationsensor-absoluteorientationsensor

浏览器兼容性

参见