device-motion
This repository contains a little library I created to react on device-motion events.
Installation
npm install device-motion # OR yarn add device-motion
Sample
The following sample demonstrates how I use it with React.
; ; Component { superprops; thisseismograph = null; } { if !thisseismograph thisseismograph = minShakes: thispropsminShakes || 3 minAmplitude: thispropsminAmplitude || 3 onShake: thisonShake delay: thispropsdelay || 1500 ; thisseismograph; }; { if thisseismograph thisseismograph; }; { ... }; { ... };