usedeviceorientation
v1.0.2
Published
React hook for subscribing to Device orientation
Downloads
9
Maintainers
Readme
useDeviceOrientation
subscribes to deviceOrientationEvent
Note: This is using the new React Hooks API Proposal
Install
npm install usedeviceorientation --save
- Yarn
yarn add usedeviceorientation
Usage
import useDeviceOrientation from 'usedeviceorientation';
function yourComponent() {
let orientation = useDeviceOrientation();
// {
// absolute: DeviceOrientationEvent.absolute,
// alpha: DeviceOrientationEvent.alpha,
// beta: DeviceOrientationEvent.beta,
// gamma: DeviceOrientationEvent.gamma
// }
// ...
}