useDeviceMotion
Reactive DeviceMotionEvent. Provide web developers with information about the speed of changes for the device's position and orientation.
Package: @vueuse/core
Category: Sensors
Usage
import { useDeviceMotion } from '@vueuse/core'
const {
acceleration,
accelerationIncludingGravity,
rotationRate,
interval,
} = useDeviceMotion()Options
| Option | Type | Default | Description |
|---|---|---|---|
| requestPermissions | boolean |
false | Request for permissions immediately if it's not granted, |
Returns
| Name | Type |
|---|---|
| acceleration | Ref |
| accelerationIncludingGravity | Ref |
| rotationRate | Ref |
| interval | shallowRef |
| isSupported | useSupported |
| requirePermissions | useSupported |
| ensurePermissions | Ref |
| permissionGranted | shallowRef |