1.0.2 • Published 6 years ago

usedeviceorientation v1.0.2

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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
// }

  // ...
}