After creating an instance, you can add a callback using
on('wheel', callback), which will be called with the a WheelEventState object.
The data provided is easily extracted using object & array destructuring.
See below in what form the data is provided.
This is the TypeScript type of the WheelEventState object provided. Even if you do not use TypeScript, this might be helpful to see how the data is provided:
Tested with all current versions of all major browsers (Chrome, Firefox, Safari, Edge)
- macOS + Magic Mouse & Magic Trackpad
- Windows 10 + Precision Touchpads (PTP)
To cleanup you can use one of the following methods to remove the callback: