usedeviceorientation

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i usedeviceorientation

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

3.06 kB

Total Files

4

Last publish

Collaborators

  • aniket965