Detect Prefers Reduced Motion 🥴 🔍️ 👀️
A micro ES6 module (~0.5KB) for detecting a users prefers-reduced-motion
and watching for changes.

Installation
npm install @egstad / detect - motion
Usage
import detectMotion from '@egstad/detect-motion'
window.addEventListener('reducedMotionUpdated', (e) => {
if (e.detail.reduce) {
} else {
}
})
detectMotion.watch()
Methods
The watch()
method is more than likely all you'll need. Here's a list of what each method in the module does.
detectMotion.get()
detectMotion.watch()
detectMotion.destroy()
Example
Here is a screencap demonstrating the realtime updates on Mac OS (System Preferences > Accessibility > Display > Reduce Motion).
